1.停掉MysqL服务:
sudo service MysqL stop
2.以安全模式启动MysqL:
sudo MysqLd_safe --skip-grant-tables --skip-networking &
注意我们加了--skip-networking
,避免远程无密码登录 MysqL。
3.直接输入:
MysqL -u root
4.重置密码:
MysqL> use MysqL; MysqL> update MysqL.user set authentication_string=password('root') where user='root' and Host ='localhost'; MysqL>update user set plugin="MysqL_native_password"; MysqL>flush privileges; MysqL>quit;
5.然后登录即可:
MysqL -u root -p原文链接:https://www.f2er.com/ubuntu/353181.html