The reason: root password is wrong.
Workaround: Turn off the MySQL service, restart the MySQL service, and when you start MySQL, specify that you do not need to verify the password. Then log in to MySQL, change the password, and exit. Then restart the MySQL service.
1. Turn off MySQL
2. Start MySQL, specify no need to verify password
C:\Program files\mysql\mysql Server 5.1\bin>mysqld--defaults-file= "C:\Program
Files\mysql\mysql Server 5.1\my.ini "--console--skip-grant-tables
3. Open a window, root login, change password
C:\Program files\mysql\mysql Server 5.1\bin>mysql-uroot mysql (explanation:-uroot mysql behind this mysql refers to the connection to the MySQL library, because skipping permission validation, so You can log in to MySQL without a password)
Mysql>
MySQL>UPDATEuserSET Password=Password ('newpassword 'whereUSER='root'; MySQL > Privileges ; MySQL >
4. Restart MySQL again
mysql:1045 access denied for user ' root ' @ ' localhost ' using password Yes