linux下忘记mysql的root密码

一.处理方案

#1. 结束当前正在运行的mysql进程

 /etc/init.d/mysql stop

#2. 用mysql安全模式运行并跳过权限验证

mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

#3. 用空密码方式使用root用户登录 MySQL

#  mysql -u root mysql 

#4. 更新密码为root

update user set Password = PASSWORD('root') where User ='root';

#5. 刷新权限

FLUSH PRIVILEGES; 

#6. 退出

quit

 

posted @ 2019-04-13 21:17  阿布_alone  阅读(1069)  评论(0编辑  收藏  举报
TOP