当前位置:Gxlcms > 数据库问题 > linux 忘记mysql用户root密码 解决方案

linux 忘记mysql用户root密码 解决方案

时间:2021-07-01 10:21:17 帮助过:2人阅读

1.vim /etc/my.cnf
[mysqld]
skip-grant-tables ##追加此行,跳过权限表,

2.重启mysql
systemctl restart mysqld

3.mysql 登陆mysql
mysql> use mysql;
mysql> UPDATE user SET Password = password ( ‘zha123456‘ ) WHERE User = ‘root‘ ;
mysql> flush privileges ; 
mysql> quit

4.恢复配置文件my.cnf
vim /etc/my.cnf
[mysqld]
skip-grant-tables ##去掉此行,继续校验权限表,

5.重启mysql
systemctl restart mysqld

linux 忘记mysql用户root密码 解决方案

标签:ble   恢复   grant   ant   sys   update   res   tables   inux   

人气教程排行