This article introduces how to forget the password of the mysql database server on the linux server. Next we can retrieve the password step by step. 1. log on to the linux server through ssh, and send the kill command to the mysqld server to turn off the mysqld server (not kill-9). The file storing the process ID is usually located in the directory of the mysql database. (Mark the command input in red)
The Code is as follows: |
Copy code |
# Killall-TERM mysqld
|
2. Use the '-- skip-grant-tables' parameter to start the mysql path of the wdcp System for mysqld (/www/wdlinux/mysql/bin, change the mysql path ).
The Code is as follows: |
Copy code |
# Cd/www/wdlinux/mysql/bin/# mysqld_safe -- skip-grant-tables |
Status after startup,
3. Do not close the original ssh client (if the client times out, the password reset may fail, so it is recommended that you complete the password reset process within a few minutes). log on to the new ssh client, after logging in, enter the mysql command to log on to mysql:> mysql, and then enter the following command to reset the password:
The Code is as follows: |
Copy code |
> Use mysql > Update user set password = password ("123456") where user = "root "; > Flush privileges; |
4. Enter the following command:
The Code is as follows: |
Copy code |
# Killall-TERM mysqld # Service mysqld start |
5. Try logging in with a new password.