Restore the MySQL root User Password

Source: Internet
Author: User

The password of the MySQL root User is frequently used by all of us. In actual operations, if you forget the password of the MySQL root User, you can use the following procedure to restore it, the following is a description of the specific solution. I hope it will help you in your future study.

 
 
  1. Kill 'cat/MySQL (the best combination with PHP)-data-directory/hostname. pid'

Use the -- skip-grant-tables option to restart MySQL (the best combination with PHP) d.

Use MySQL (the best combination with PHP)-h hostname MySQL (the best combination with PHP) to connect to MySQL (the best combination with PHP) d server and use a GRANT command to change the password. You can also use MySQL (the best combination with PHP) admin-h hostname-u user password 'new password.

This is what we can find from baidu and google. In fact, it is also in the MySQL (best combination with PHP) Manual (8.9 how to reset a forgotten password, but this time I failed in windows...

If you forget the password of the MySQLroot user, you can use the following procedure to restore it.

By sending a kill instead of kill-9) to MySQL (the best combination with PHP) d server, you can disable MySQL (the best combination with PHP) d server. Pid is stored in a. pid file, which is usually in the MySQL (best combination with PHP) database directory:

Kill 'cat/MySQL (the best combination with PHP)-data-directory/hostname. Pi' you must be a UNIX root user or the same user on the running server.

Use the -- skip-grant-tables option to restart MySQL (the best combination with PHP) d.

Use MySQL (the best combination with PHP)-h hostname MySQL (the best combination with PHP) to connect to MySQL (the best combination with PHP) d server and use a GRANT command to change the password. See section 7.26 GRANT and REVOKE syntax. You can also use MySQL (the best combination with PHP) admin-h hostname-u user password 'new password.

Use MySQL (the best combination with PHP) admin-h hostname flush-privileges or SQL command FLUSH PRIVILEGES to load the permission table

This is what we can find from baidu and google. In fact, it is also in the MySQL (best combination with PHP) Manual (8.9 how to reset a forgotten password, but this time I failed in windows...

Because I only have one user: select user, host from user

| Root | localhost |

Later I used

 
 
  1. update user set password=PASSWORD('');  

But I used the following error:

 
 
  1. update user set password=''; 

After logging out, you cannot log on again.

No error is reported after MySQL (the best combination with PHP) d -- skip-grant-tables is performed in the preceding steps, but MySQL (the best combination with PHP) is not started, therefore, the following MySQL (the best combination with PHP) cannot be used for logon, because 3306 is not enabled at this time.

You have to reinstall it (lessons !).

The above content is for you if you forget the MySQL root User Password introduction, I hope you will get something.

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.