MySQL:忘记root密码
首先停止mysql
service mysql stop
然后以安全模式启动mysql在后台运行:
mysqld_safe --skip-grant-tables &
然后就可以以root登录到mysql服务器上
mysql -u root
use mysql
修改MySQL的root密码:
update user set password=PASSWORD('123456') where User='root';
#MySQL 5.7
update user set authentication_string=password('123456') where user='root';
flush privileges;