Monday, March 2, 2009

Access denied for user 'root'@'localhost'

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

You can over come the error by the following way.
--------------------------------------------------

# /etc/init.d/mysql stop
# mysqld --skip-grant-tables --user=root&
# mysql
mysql> use mysql
mysql> update user set Password='' where User='root';
mysql> exit
# killall -9 mysqld
# /etc/init.d/mysql start
# mysql -p
Enter password:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
mysql> FLUSH PRIVILEGES;
mysql> exit

No comments: