Access denied for user 'root' @ 'localhost' (using password: YES) (correct solution), deniedlocalhost
This article describes the mysql error: Access denied for user 'root' @ 'localhost' (using password: YES) solution. for more information, see.
Note: Red is the focus
Error description
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)
Solution
Windows Environment
Edit mysql configuration file my. ini (do not know where to search), add skip-grant-tables under [mysqld]
Save and exit and restart mysql
1. Click Start> Run (shortcut: Win + R ).
2. Start: Enter net stop mysql
3. Stop: Enter net start mysql
Cmd mysql-u root-p press ENTER
If mysql is not an executable command in cmd, it indicates that your mysql is not added to the environment variable, please automatically cd to the bin directory of the mysql installation directory and then run mysql-u root-p press ENTER
1. Enter the mysql database:
Mysql> use mysql;
2. Set a new password for the root user:
Mysql> update user set password = password ("new password") where user = "root ";
3. Refresh the database
Mysql> flush privileges;
4. Exit mysql:
Mysql> quit
Modify the my. ini file, delete the "skip-grant-tables" line we just added, save and quit, and restart mysql.