Linux---mysql password recovery method

Source: Internet
Author: User

MySQL The root user forgot password recovery method:

1. Close all running mysqld processes first:

Killall mysqld

2. Start MySQL with the Skip authorization table parameter:  

Mysqld_safe--skip-grant-tables--user=mysql &

3, for [email protected] To set a new password:  

Mysql-u root-p//log in to the database with a blank password

Use MySQL; Select the name of the library to manipulate

Update user set Password=password (' NewPassword ') where user= ' root '; Change the root user's password

4, the normal restart after MySQL can be used to login with the new password or flush privileges;


Note: 1) If you are familiar with the SQL statement, the update does not have to explain the first user is a table

The first name and the second user are the fields in the table. The first password is the field in the table, and the second password () is
The function used for encryption. New_pass is the password to change.

2) flush privileges can not be added. Direct restart


Linux---mysql password recovery method

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.