Under Windows:
Open the Command Line window to stop the MySQL service:
The code is as follows |
Copy Code |
Net stop MySQL
|
Start MySQL, general to MySQL installation path, find Mysqld-nt.exe (or Mysqld.exe)
Execution: Mysqld-nt (or Mysqld.exe)--skip-grant-tables the current window will stop.
Also open a command line window, execute MySQL If prompted without this command, first go to MySQL installation location under the Bin directory and then run MySQL
The code is as follows |
Copy Code |
>use MySQL >update User Set Password=password ("New_password") where user= "root"; >flush privileges; >exit
|
With Ctrl+alt+del, find the mysqld-nt process kill it, restart the Mysql-nt service, you can log in with the new password
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, start in normal way
Replace with the same version of the MySQL library: (Be sure to back up first)
1, re-install the same version of MySQL on another computer
2, delete the forgotten password of the computer in the MySQL installation directory datamysql all content (to stop the MySQL service first)
3,copy new computer on the MySQL installation directory datamysql all content to just delete the directory
4, start the MySQL service