Use SKIP-GRANT-TABLES to solve MYSQLROOT password loss _ MySQL

Source: Internet
Author: User
This article describes how to use SKIP-GRANT-TABLES to solve the problem of MYSQLROOT password loss. if you need it, you can refer to forget MySQL (the best combination with PHP) the ROOT password is a common problem in the use of MySQL (the best combination with PHP), but many of my friends don't reset the ROOT password. it's so bitter, I feel deeply touched, close up this article to share with you:

1. edit the MySQL configuration file (the best combination with PHP:

In windows: % MySQL (the best combination with PHP) _ installdir % \ my. ini // I. ini is the configuration file of MySQL (the best combination with PHP.

In linux:/etc/my. cnf

Add the following line in the [MySQL (best combination with PHP) d] configuration section:

Skip-grant-tables

Save and exit editing.

2. restart MySQL (the best combination of PHP and MySQL ).

In windows:

Net stop MySQL (the best combination with PHP)

Net start MySQL (the best combination with PHP)

In linux:

/Etc/init. d/MySQL (the best combination with PHP) d restart

3. set a new ROOT password.

Then run the following command in the command line:

MySQL (the best combination with PHP)-uroot-p MySQL (the best combination with PHP)

Press enter to enter the database without a password.

Run the following statement to update the root password to 7758521:

Update user set password = PASSWORD ("123456") where user = 'root ';

Quit exits MySQL (the best combination with PHP ).

4. restore the configuration file and restart the service.

Then, modify the MySQL configuration file (the best combination with PHP) to delete the line added.

Restart MySQL (the best combination with PHP) again, and the password is changed.

Modification completed.

Use the new password 123456 to try it out. can I log on to MySQL again (the best combination with PHP?

Summary:

1. first kill the mysqld process:

Tips: Make sure you forget your MySQL password.

2. use the skip-grant-tables option to start MySQL:

Tips: Make sure you forget your MySQL password.

3. log on to change the password:

Tips: Make sure you forget your MySQL password.

4. turn off MySQL

Tips: Make sure you forget your MySQL password.

5. start MySQL

Tips: Make sure you forget your MySQL password.

The above section describes how to use SKIP-GRANT-TABLES to solve mysql root password loss.

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.