Linux under the root password of MySQL forgot, how to change the root password

Source: Internet
Author: User

In the company's production environment, due to the server's root password is always developed to master, has been in the final change to a library must use the root authority, helpless development finally told me a sentence, the password is too complex, I also forget. I can only silently back, turned away, but in mind, only five words ' dead your mother yo '. The root password is TM to forget, develop a hair ah.

Back to Operations Control console I began to think how to change the root password, online to find a lot of methods, in the test machine has tried also not, let me feel despair, I want to turn the book good, finally found the answer in the book, here to share a wave.

First step Change configuration file

Everyone's profile path is different, my profile path is in/ETC/MY.CNF

In the [mysqld] configuration file for this configuration file, add the

Skip-grant-tables

Then restart the database

Service mysqld Restart

Second step into the database to change the password

It's time to go straight to the database.

MySQL see directly into the database

View all libraries

show databases;

Go to MySQL Library

Use MySQL;

Set a new root password

Update Mysql.user set Authentication_string=password (' 123456 ') where user= ' root ';

Refresh

Flush privileges;

Exit database

Restart MySQL

Service mysqld Restart

Step three verification

Enter the database with the password you just set

mysql-uroot-p123456

Then go to the config file to delete the phrase just configured.

Skip-grant-tables

If you do not delete, you can enter MySQL directly into the database, so delete

Restart the database.

Now you can order a cup of Starbucks you like and enjoy it all

Linux under the root password of MySQL forgot, how to change the root password

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.