mysql修改密码

进入mysql, 执行如下命令: 

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

5.7以后版本修改密码: 

use mysql;
select plugin from user where user = 'root';
# 将指修改为默认值
update user set plugin='mysql_native_password';
# 修改密码
update user set authentication_string=password('root') where user='root' and host='localhost';
# 刷新权限
flush privileges;
# 修改密码
alter user 'root'@'localhost' identified by 'newPassword';
原文地址:https://www.cnblogs.com/hujingnb/p/10246226.html