Loading

mysql忘记密码

使用源码安装的MySQL忘掉密码
关闭mysql服务
修改/etc/my.cnf,设置免密登陆mysql

#vim /etc/my.cnf
[mysqld]
skip_grant_tables

启动mysql

#systemctl start mysql

更新密码

# mysql -u
mysql> update mysql.user set authentication_string=PASSWORD('123456') where user='root';
mysql> flush privileges;
exit

关闭免密登陆,注释(删除)掉/etc/my.cnfskip_grant_tables

#systemctl stop mysql
#vim /etc/my.cnf
#systemctl start mysql
# mysql -uroot -p123456
posted @ 2021-10-20 17:27  萝卜青菜~  阅读(15)  评论(0编辑  收藏  举报