[url]http://blog.youkuaiyun.com/lyflower/article/details/6137021[/url]
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# 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>
mysql>
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# 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>
mysql>
本文介绍了一种在忘记MySQL root密码的情况下如何通过一系列命令来重置密码的方法。具体步骤包括:停止MySQL服务、以安全模式启动MySQL、更新root用户的密码、重启MySQL服务并使用新密码登录。
3万+

被折叠的 条评论
为什么被折叠?



