美文网首页学ubuntuUbuntu学习
ubuntu18.04 首次登录mysql未设置密码或忘记密码解

ubuntu18.04 首次登录mysql未设置密码或忘记密码解

作者: 苍简 | 来源:发表于2019-01-24 22:20 被阅读13次

sudo cat /etc/mysql/debian.cnf

image.png
mysql -u debian-sys-maint -p
//注意! 
//这条指令的密码输入是输入第一条指令获得的信息中的 password = ZCt7QB7d8O3rFKQZ 得来。
//请根据自己的实际情况填写!
image.png

修改密码

use mysql;
// 下面这句命令有点长,请注意。
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password"; 
flush privileges;
quit;

image.png

重新启动mysql

转载自:https://blog.csdn.net/qq_38737992/article/details/81090373

相关文章

网友评论

    本文标题:ubuntu18.04 首次登录mysql未设置密码或忘记密码解

    本文链接:https://www.haomeiwen.com/subject/qoqpjqtx.html