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