linux忘记Mysql密码

来源:互联网 发布:socket编程 tcp udp 编辑:程序博客网 时间:2024/05/23 19:06
停止服务# /etc/init.d/mysql stop
跳过安全设置# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
以root用户登录# mysql -u root mysql
更新密码mysql> update user set password=password('newpassword') where user='root';
刷新数据mysql> flush privileges;
关闭mysql> quit
重新启动# /etc/init.d/mysql restart
重设密码# mysql -uroot -p
enter password: <输入新设的密码newpassword>
0 0