Linux mysql modify the user name and password

After the MySQL database password forget, you can go to the next linux modify the original password for the next step.
Step one: landing a server administrator privileges.
Step two: enter the MySQL data configuration file

[root @ VM_0_8_centos ~] # vi /etc/my.cnf

    1

last line to add a password-free login: Skip-Grant-the Tables

: WQ save and exit.

The third step: restart

[root @ VM_0_8_centos ~] # systemctl restart mysqld.service

    1

Check if successful: systemctl Status mysqld.service
MySQL start

Step Four: free secret landing database

[root @ VM_0_8_centos ~] # mysql -uroot -p
password the enter:

    1
    2

here you can enter a carriage return.

Step Five: Modify mysql password

selected database: use mysql;

5.7 above operation: SET password = Update User password ( "newPassword") WHERE User = 'the root';

5.7 Run the following versions: update user set authentication_string = password ( "newPassword ") WHERE User = 'the root';

    . 1
    2
    3
    4
    5

Step Six: quit exit, the skip-grant-tables to add to cancel the second step file

Step seven: Restart repeat the third step. Modifications are complete, the password can log in successfully.

Oriented development process, recording the road learning.
----------------
Disclaimer: This article is the original article CSDN bloggers "Muzi La La La La", following the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/qq_42685333/article/details/89574884

Guess you like

Origin www.cnblogs.com/barrywu/p/12055376.html