One of the simplest restoration methods:
Set password for = PASSWORD (123456 );
Put the above file! Statement is SQL .txt
Stored in any folder
I am storing it in E: sevser.
Run E: sevsermysqlinmysqld-nt -- init-file = E: sevsersql.txt in "run ".
Then restart the server. Then, the ROOT password is automatically changed to 123456.
Here, E: sevsermysql should replace the MYSQL installation directory on your own server
If you change the ROOT name, you need to change the root name for you !!
There is also a method:
Windows:
1. log on to the system as a system administrator.
2. Stop MySQL services.
3. Go to the Command window and enter the MySQL installation directory. For example, if my installation directory is c: mysql, go to C: mysqlin.
4. Skip the permission check and start MySQL,
C: mysqlin> mysqld-nt -- skip-grant-tables
5. open a new window, enter the c: mysqlin directory, and set the new root password.
C: mysqlin & gt; mysqladmin-u root flush-privileges password "198651"
C: mysqlin> mysqladmin-u root-p shutdown
Replace newpassword with the root password you want to use. The second command will prompt you to enter a new password, repeat
Password.
6. Stop MySQL Server and start Mysql in Normal Mode
7. You can use a new password to link to Mysql.
Command:
Net mysql start MYSQL
Net stop mysql stop MYSQL
The following uses Windows as an example. In linux, replace mysqld-nt in step 2 with safe_mysqld.
1. Stop the mysql5 service:
Net stop mysql5
2. Open a DOS window for execution:
C: mysqlin> mysqld-nt -- skip-grant-tables &
3. Open another DOS window for execution:
C: mysqlin> mysql
> Update user set password = password (123456) where user = root;
Set the root password to 123456!
4. Start the mysql5 service:
Net start mysql5