July 27, 2009 | In: how-to, Tips & Tricks
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
Today I got the error below :
|
1 |
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) |
after typing :
|
1 |
mysql -u root |
I don’t know why ? but I know how to solve it.
First of all let’s disable password authentication :
Stop your MySQL daemon:
|
1 |
/etc/init.d/mysql stop |
or
|
1 |
/etc/init.d/mysqld stop |
Then run the following command line in background :
|
1 |
mysqld_safe --skip-grant-tables & |
Secondly run :
|
1 |
mysql -u root |
Finally, In your MySQL command line prompt issue the following command:
|
1 2 3 4 |
USE mysql;
UPDATE user SET password=PASSWORD("my_password") WHERE user="root";
FLUSH PRIVILEGES;
EXIT |
Password is now reset to my_password. So just restart your MySQL server using :
|
1 |
/etc/init.d/mysql restart |
or
|
1 |
/etc/init.d/mysqld restart |
and use your new password to authenticate :
|
1 |
mysql -u root -p |
All that remains is to enter your password.
4 Responses to ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
Gbenga
August 27th, 2009 at 22:55
el arbi
December 25th, 2009 at 07:12
Oussama
June 4th, 2010 at 10:15
geomatag
September 11th, 2010 at 02:43