MySQL5.7修改密码
为了提高安全性,mysql5.7中 user 表的 password 被 authentication_string 字段所取代,下面简绍几种修改root密码的方法。
方法1:
mysql> alter user 'root'@'localhost' identified by '12345678';
方法2:
mysql> set password for 'root'@'localhost'=password('12345678');
方法3:
mysql> update mysql.user set authentication_string=password('12345678') where user='root' and Host = 'localhost';
记得最后一定要刷新权限
mysql> flush privileges;
以上方法在Mariadb中同样适用。