新版本mysql 命令:alter user 用户名@localhos identified by '新密码';
例子:
set password for root@localhost = password('123');
alter user 'root'@'localhost' identified by '123';
方法二:用UPDATE直接修改user表
--使用mysql数据库
use mysql;
--更改user表中指定用户的密码
update user set password=password('123') where user='root' and host='localhost';
--权限刷新
flush privileges;