Article to introduce about the forgotten MySQL root password reset method, also introduced in different operating systems, the following describes the Linux and Windows solutions, there is a need for friends to understand.
If you forget the MySQL root password, you can reset it in the following ways:
Linux operating methods
In the MY.CNF [mysqld] field, add:
The code is as follows Skip-grant-tables
Then restart your mysqld, so long without the password.
And then into MySQL.
The code is as follows UPDATE Mysql.user SET Password=password (' Password ') WHERE user= ' root ';
After success
The code is as follows FLUSH privileges;
Finally remove the skip-grant-tables from the MY.CNF
Restart Mysqld.
How Windows operates
1. Kill the MySQL process in the system;
2. Use the following command to start MySQL, to do not check the permissions of the way to start;
The code is as follows Mysqld_safe-skip-grant-tables &
3. Then use the null password method to log in to MySQL with root user;
The code is as follows Mysql-u Root
4. Change the password of root user;
The code is as follows mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root '; mysql> flush Privileges; Mysql> quit
5. Restart MySQL, you can log in with the new password.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.