mysql5.7 修改用户密码_Mysql修改密码

为了提高安全性 mysql5.7中user表的password字段已被取消,取而代之的事 authentication_string 字段,当然我们更改用户密码也不可以用原来的修改user表来实现了。下面简绍几种mysql5.7下修改root密码的方法(其他用户也大同小异)。


法一:

mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

法二:

mysql> alter user 'root'@'localhost' identified by '123';

法三:

mysql> set password for 'root'@'localhost'=password('123');

记得最后要刷新权限

mysql> flush privileges;

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

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