Use Skip-grant-tables to resolve MYSQL root password loss _mysql

Source: Internet
Author: User

Forget MySQL (and PHP with the best combination) root password is in the MySQL (and PHP with the best combination) use a very common problem, but a lot of friends will not reset the root password, that complain Ah, I have deep feelings, close-up this article to communicate with you:

1, edit the MySQL (and PHP collocation of the best combination) Profile:

Windows environment:%mysql (the best combination of PHP) _installdir%\my.ini//General configuration file with My.ini, MySQL (the best combination of PHP) and MySQL (best combination of PHP).

Linux Environment:/ETC/MY.CNF

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

Skip-grant-tables

Save exit Edit.

2, and then restart MySQL (and PHP with the best combination) services

In the Windows environment:

net stop MySQL (best combination with PHP)

net start MySQL (best combination with PHP)

In Linux environments:

/etc/init.d/mysql (best combination with PHP) d restart

3, set the new root password

And then execute at the command line:

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

Direct return to enter the database without a password.

Now we execute the following statement to update the root password to 7758521:

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

Quit Exit MySQL (the best combination with PHP).

4, restore the configuration file and restart the service

Then modify the MySQL (and PHP Best Mix) profile to remove the line that you just added.

Re-reset MySQL (and PHP with the best combination) service, password modification completed.

Modification completed.

Try it with the new password 123456, and login to MySQL (the best combination of PHP) is not the same feeling?

Summarize:

1. First kill the MYSQLD process:

Tips: Let you forget the MySQL password is not afraid

2. Use the Skip-grant-tables option to start MySQL:

Tips: Let you forget the MySQL password is not afraid

3. Login Modify Password:

Tips: Let you forget the MySQL password is not afraid

4. Turn off MySQL

Tips: Let you forget the MySQL password is not afraid

5. Start MySQL

Tips: Let you forget the MySQL password is not afraid

The above is this article to introduce you to use Skip-grant-tables to solve the MYSQL root password loss, I hope you like.

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.