ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
July 27th, 2009
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.











still not working i have tried the steps over and over
hello can you telle me pleaze how can we do it in windows (with wamp)
Hello,
I get this error on WAMP(Windows) when i tried to connect to the database via phpMyAdmin
you can do the following :
- go to %WAMP_DIR%\apps\phpmyadmin2.11.6\config.inc.php file
- change the value of $cfg['Servers'][$i]['password'] to your password
- restart the services (Apache & MySQL)