mysql root密码找回

1. 停止mysql 服务
 /etc/init.d/mysqld stop

2. 用以下命令启动MySQL,以不检查权限的方式启动;
  
mysqld_safe --skip-grant-tables &  

3. 然后用空密码方式使用root用户登录 MySQL;

  
mysql -u root  

4. 修改root用户的密码;

MySQL> update MySQL.user set password=PASSWORD('新密码') where User='root';   MySQL> flush privileges;   MySQL> quit  

5. 重启服务,新密码登陆
   
/etc/init.d/mysqld start
   

猜你喜欢

转载自pobing.iteye.com/blog/1344773