Under Windows Server
1. Stop MySQL service (as Administrator, run under cmd command line) Use the following command:
The code is as follows |
Copy Code |
net stop MySQL
|
2. Use the command to start the MySQL database, the following command
The code is as follows |
Copy Code |
Mysqld--skip-grant-tables
|
3. Open a new CMD window, do the following command operation
The code is as follows |
Copy Code |
1, Mysql-uroot 2, update mysql.user set Password=password (' Your password ') where user= ' root;
|
As shown in figure:
under Linux:
If MySQL is running, first kill: Killall-term mysqld.
Start Mysql:bin/safe_mysqld--skip-grant-tables &
You can enter MySQL without the need for a password.
Then it's
The code is as follows |
Copy Code |
>use MySQL >update User Set Password=password ("New_pass") where user= "root"; >flush privileges;
|
Re-kill MySQL, the normal way to start MySQL.
Related documents can refer to: http://www.111cn.net/database/mysql/41423.htm