mysql 忘记root密码

系统ubuntu

操作如下:

1:sudo service mysql stop

2:  sudo  mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

3:  mysql -u root mysql

4:这就进入了mysql 终端,然后

      mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;   
      mysql> FLUSH PRIVILEGES;
      mysql> quit

5:sudo service mysql start

还有其他方法:不过自己没有尝试。

参考链接:

http://www.jb51.net/LINUXjishu/10981.html

猜你喜欢

转载自hongtoushizi.iteye.com/blog/2115838
今日推荐