update user set password=PASSWORD('hooray') where user='root';
update user set authentication_string=PASSWORD('hooray') where user='root'; --mysql5.7
flush privileges;
quit;
mysql -uroot -p
update user set password=PASSWORD('123456') where user='root';
update user set authentication_string=PASSWORD('hooray') where user='root'; --mysql5.7
flush privileges;
quit;
本文提供了在MySQL中更新root用户密码的方法,包括使用password和authentication_string字段,适用于不同版本的MySQL,如5.7版,并强调了flush privileges的重要性。
8810

被折叠的 条评论
为什么被折叠?



