Forget MySQL (and PHP with the best combination) root password is in the MySQL (and PHP with the best combination) use a very common problem, but a lot of friends will not reset the root password, that complain Ah, I have deep feelings, close-up this article to communicate with you:
1, edit the MySQL (and PHP collocation of the best combination) Profile:
Windows environment:%mysql (the best combination of PHP) _installdir%\my.ini//General configuration file with My.ini, MySQL (the best combination of PHP) and MySQL (best combination of PHP).
Linux Environment:/ETC/MY.CNF
Add the following line to the [MySQL (best combination with PHP) d] configuration section:
Skip-grant-tables
Save exit Edit.
2, and then restart MySQL (and PHP with the best combination) services
In the Windows environment:
net stop MySQL (best combination with PHP)
net start MySQL (best combination with PHP)
In Linux environments:
/etc/init.d/mysql (best combination with PHP) d restart
3, set the new root password
And then execute at the command line:
MySQL (best combination with PHP)-uroot-p MySQL (best combination with PHP)
Direct return to enter the database without a password.
Now we execute the following statement to update the root password to 7758521:
Update user set Password=password ("123456") where user= ' root ';
Quit Exit MySQL (the best combination with PHP).
4, restore the configuration file and restart the service
Then modify the MySQL (and PHP Best Mix) profile to remove the line that you just added.
Re-reset MySQL (and PHP with the best combination) service, password modification completed.
Modification completed.
Try it with the new password 123456, and login to MySQL (the best combination of PHP) is not the same feeling?
Summarize:
1. First kill the MYSQLD process:
Tips: Let you forget the MySQL password is not afraid
2. Use the Skip-grant-tables option to start MySQL:
Tips: Let you forget the MySQL password is not afraid
3. Login Modify Password:
Tips: Let you forget the MySQL password is not afraid
4. Turn off MySQL
Tips: Let you forget the MySQL password is not afraid
5. Start MySQL
Tips: Let you forget the MySQL password is not afraid
The above is this article to introduce you to use Skip-grant-tables to solve the MYSQL root password loss, I hope you like.