当前位置 往事如风 MySQL 正文 下一篇:

MySQL5.7修改密码方法

MySQL 5.7 修改密码方法

1、 update 方法

为了提高安全性 mysql5.7中user表的password字段已被取消,取而代之的事 authentication_string 字段,所以通过update方法修改密码的语句如下:

mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost';
mysql> flush privileges;

2、 alter方法

mysql> alter user 'root'@'localhost' identified by '123456';
mysql> flush privileges;

3、 set 方法

mysql> set password for 'root'@'localhost'=password('123456');
mysql> flush privileges;
本文来自网络,不代表往事如风立场,转载请注明出处:https://www.pastlikewind.com/2020/02/18/1179/

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

返回顶部