What if MySQL loses the root password?

Source: Internet
Author: User

It is very sad to lose the password, especially the root password :(. I lost my own installation and play, but it would be too much trouble if the server crashes! It is assumed that the root password is lost due to intrusion. Here I will talk about my own views on this issue. First of all, there is no need to panic when we encounter such a problem. The whole recovery process is also very simple.

1. Download the MySQL source code distribution package. We don't need to differentiate the operating system. We need the same thing.


2. Rename the mysql folder in the data directory of your mysql database to oldmysql.


3. Copy the mysql directory under the data directory in the source code package to the data directory of your mysql.


4. Restart mysql. Now the mysql authorization relationship is the same as that of the new installation. log on with a blank password and adjust the authorization.


5. Open the database oldmysql and check for any problems.


6. If there is a backup, the integrity of the original database in the system will be checked to avoid modification.

Through the above six steps, you can completely restore your control over mysql. The key point is to check the Permissions Modified by the other party and the data integrity check in the last two steps.

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.