MySQLroot密碼的恢復方法ubuntu
有可能你的系統沒有 safe_MySQLd 程序(好比我如今用的 ubuntu操做系統, apt-get安裝的MySQL) , 下面方法能夠恢復ui
1.中止MySQLd;
sudo /etc/init.d/MySQL stop
(您可能有其它的方法,總之中止MySQLd的運行就能夠了)spa
2.用如下命令啓動MySQL,以不檢查權限的方式啓動;
MySQLd --skip-grant-tables &操作系統
3.而後用空密碼方式使用root用戶登陸 MySQL;
MySQL -u rootrest
4.修改root用戶的密碼;
MySQL> update MySQL.user set password=PASSWORD('newpassword') where User='root';
MySQL> flush privileges;
MySQL> quit ip
從新啓動MySQL
/etc/init.d/MySQL restart
就能夠使用新密碼 newpassword 登陸了。get