What if MySQL forgets the root password? In general, there are two ways of thinking: Retrieve the password and reset the password. In the actual work,theMySQL database forgot the root password is generally used to reset the password method to solve. Here's a look at the steps to reset the root password under Linux and under Windows.
what happens when MySQL forgets the root password under Windows?
1. Log on to the system as a system administrator and start the MySQL skip permission check.
D:\mysql\bin\mysqld-nt–skip-grant-tables
2. Go to D:\mysql\bin and use mysqladmin Command Set Password
d:\mysql\bin\mysqladmin-u root flush-privileges password "New password"
3. Restart MySQL in cmd
net start MySQL
What if MySQL forgets the root password under Linux?
1. Start MySQL with the following command to start without checking permissions;
[email protected] mysql]# Safe_mysqld–skip-grant-tables &
[email protected] mysql]# Mysqld–skip-grant-tables &
2. Then log in to MySQL using the root user with a blank password
[email protected] mysql]# mysql-u root
3. Change the password of the root user;
mysql> Update mysql.user set Password=password (' New password ') where user= ' root ';
mysql> flush Privileges;
Restart MySQL and you will be able to log in with your new password.
Fix windows&linux under MySQL forgot root password