- Faster Performance
- Improved Code Readability
- Replace "IF A THEN B " with "(NOT A)or B "
- Replace "IF A THEN B ELSE C " with "((NOT A)or B) AND (A OR C) "
source : SQL WHERE clauses: Avoid CASE, use Boolean logic
: fetched added contents with "<pre>" tags
: fetched the original string ( in Chrome )
: fetched blank string ( in Firefox)
: fetched the original string ( in Chrome & Firefox)
Mysql #1130 - Host 'localhost' is not allowed to connect to this MySQL server
Cause : trying to set password of mysql.user manually.
mysql>update user set Password='newpwd' where user='root'
mysql.user table stores Password in encrypted format.
So, if one attempts to set the Password manually using UPDATE statement, it updates the record as plain text password instead of encrypted password.
When user connects, the server reads the Password value from the user table and decrypts it to match creditials that were sent from the client.
Step 1 : Stop the mysql service if it's already running
Step 2 : Create a text file 'mysql-init.txt' with following contents.
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
- UPDATE statement updates the mysql.user table with encrypted Password for user 'root'
- FLUSH statement tells the server to reload the grant tables into memory.
Step 3 : Go to command promt (cmd)
C:\> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt
The server executes the contents of the file named by the --init-file option at startup, changing each root account password.
reference : dev.mysql.com