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

猜你喜欢

转载自www.cnblogs.com/tjp40922/p/10702962.html
今日推荐