环境
UBUNTU 18.04 + mysql 5.7.28
方法
1、打开mysql。
mysql -uroot
2、利用以下命令修改密码
use mysql;
update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
quit;
运行的实际效果如下图。

本文详细介绍在Ubuntu18.04系统环境下,如何通过MySQL命令行操作,使用SQL语句来重置root用户的登录密码,包括使用authentication_string字段设置新密码及调整plugin字段确保密码生效的具体步骤。
1万+

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



