Long time no use of the database, it is inevitable that the password to forget the database, if the MySQL database password forgot how to do? Here are two simple ways to reset your password!
How to reset a password under Windows system
If you are the server is Windows Xp/2000/2003/nt can use this method to retrieve the missing MySQL super Administrator root password
1, stop the MySQL service, CMD Open the DOS window, input net stop MySQL
2, in the CMD Command Line window, enter the MySQL installation directory such as d:mysql20080505in
3, enter the MySQL security mode, that is, when MySQL up, do not enter the password can enter the database.
Command is: Mysqld-nt--skip-grant-tables
***************************************
4, reopen a CMD command line window, enter mysql-uroot-p, use the way of NULL password login mysql (do not enter the password, directly press ENTER)
5, enter the following command to begin modifying the root user's password (note: there is a "dot" in the Mysql.user in the command)
mysql> Update Mysql.user Set Password=password ("New password") where user= "root";
6, Refresh the permission table
mysql> flush Privileges;
7, exit
Mysql> quit
This MySQL Super Administrator account root has been reset, then in the Task Manager to end the process of Mysql-nt.exe, restart MySQL! (You can also restart the server directly)
Solutions under the Unix&linux system:
1. User login system with root or running mysqld;
2. Use the KILL command to end the process of mysqld. (You can open the command line and then run the Ps-ef | grep MySQL "To view the MySQL process ID and then use" kill-9 MySQL process id "to kill the process.
3. Start MySQL Server with the –skip-grant-tables parameter
Shell>mysqld--skip-grant-tables
4. Set a new password for root@localhost
Use MySQL;
Update user SET Password=password (' New password ') where user= ' root ';
Flush privileges;
5. Restart MySQL Server, Setup complete.