viralpatel.info
News: www.viralpatel.info >> Photos of Kalamb Beach added   |   3 new lyrics post of Delhi-6 Songs added!
News: www.viralpatel.info >> blog <new> !
Blog


Are you stuck with this error of mysql ?


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'





Reason:
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.




Solution::
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';
FLUSH PRIVILEGES;



  • 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


Send to friend