How does one forget the mysql password on a linux server?

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.