5.7之前的版本
select version();
mysql> update user set password=password("新密码") where user="root";
mysql> flush privileges;
mysql> quit
5.7版本之后的(包括5.7),没有password这个字段了,则修改方法如下:
--方法1
mysql> alter user "root"@"localhost" identified by "新密码";
-- 方法2
mysql> update user set authentication_string=password("新密码") where user="root";
mysql> flush privileges;
mysql> quit
来自:https://www.cnblogs.com/liuhaidon/archive/2019/10/31/11772879.html