[Baidu experience] connection to mysql in window: Error Code 1045 and mysql1045
Error Code 1045 Access denied for user 'root' @ 'localhost' (using password: YES)
Baidu experience: jingyan.baidu.com
Method/step
- 1
Find the configuration file my. ini and open it.
In my computer, the path of my. ini is: (D: \ MySQL Server 5.6 ). If the path cannot be found, you can use the Everything software to find the location of the configuration file.
- 2
Search for the mysqld keyword, find it, add skip-grant-tables under mysqld, save and exit.
- 3
Restart mysql (Control Panel \ All control panel items \ management tools \ Services find mysql, right-click-> restart)
- 4
Then run cmd to switch to the mysql bin directory (The following is the mysql path on my computer)
> D:
> Cd d:/MySQL Server 5.6/bin
- 5
Enter the database and reset the password
Mysql> mysql-u root-p Enter
No need to worry about password Enter
Mysql> use mysql Enter
Mysql> update user set password = password ("new password") where user = "root"
Mysql> flush privileges refresh the database
Mysql> quit
- 6
Modify my. ini, comment out or delete skip-grant-tables (in case of a problem next time), save and quit
- 7
Restart the MySQL service (step 3)