Ubuntu下安装Mysql后密码忘记解决方案

Ubuntu下安装Mysql后密码忘记解决方案


第一步:

cd /etc/mysql


第二步:

sudo vim debiancnf


第三步:

假如,debian.cnf中的用户名为debian-sys-maint,则输入:

mysql -u debian-sys-maint -p输入回车,

这时需要输入密码,复制debian.cnf中的密码(不要手动输入,因为容易产生错误)

此时就进入到了MySQL了,


第四步:

修改root密码,输入:

use mysql;

update user set password=password('新密码') where user='root';

flush privileges;

quit


第五步:

用新改的root和密码登录查看。

猜你喜欢

转载自blog.csdn.net/weixin_41768978/article/details/80206994