MySQL5.7 change password

I haven't used Mysql very often. Today, I have a small program that I need to use, but I forgot how to change the user password. Search the Internet and record it.

1 update user set authentication_string = password('root'), password_expired = 'N', password_last_changed = now() where user = 'root';

It takes effect after restarting the MySQL service.

Original link: https://www.cnblogs.com/activiti/p/7810166.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325386055&siteId=291194637