When you log in to MySQL, prompt:
ERROR 1045:access denied for user: ' Root@localhost ' (Using password:yes)
Explain the password is incorrect, when you do forget the password, what to do? Do not reinstall, of course, do not need.
Linux or Unix
1. Log in to the system with root or mysqld user
2. Use KILL command to end off MYSQLD process
3. Use the--skip-grant-tables parameter to start MySQL, assuming the MySQL installation directory in/usr/local/mysql/, into the shell.
4. Execute/usr/local/mysql/mysqld_safe--skip-grant-tables & start the MySQL daemon
6. Execute/usr/local/mysql/mysqladmin-u root flush-privileges password "newpassword" to reset password for root user
7. Reboot Mysqld
The 6th step can also directly modify the MySQL user table:
mysql> use MySQL;
mysql> Update user Set Password=password ("NewPassword") where user= "root";
mysql> flush Privileges;
Windows:
1. Admin login system, stop MySQL service or end mysqld-nt process
2. Go to the command line and come to MySQL's installation directory. Assuming the installation directory is d:\mysql\, CMD enters the command line
3. Run d:\mysql\bin\mysqld-nt--skip-grant-tables start MySQL, turn off permissions check
4. Run d:\mysql\bin\mysqladmin-u root flush-privileges password "newpassword" Reset root password
5. Restart the MySQL service
The 4th step can also directly modify the MySQL table, the use of SQL statements with the Linux section, here will not repeat.