更改MySQL5.7连接密码

操作步骤

首先登录MySQL

然后依次键入命令:

user mysql

update mysql.user set authentication_string = password("你的密码") where user="用户名"

flush privileges

最后重新登录MySQL,输入新的密码即可!

示例:

mysql> use mysql; 

mysql> update mysql.user set authentication_string = password("123") where user="root";

mysql> flush privileges;