MySQL中遗忘root密码解决方法分享

以下的文章主要向大家介绍的是Mylinux下:

  如果 MySQL 正在运行,首先杀之: killall -TERM MySQLd。

  启动 MySQL :bin/safe_MySQLd --skip-grant-tables &

  就可以不需要密码就进入 MySQL 了。

  然后就是


  >use MySQL
  >update user set passwordpassword=password("new_pass") where user="root";
  >flush privileges;


  1.    >use MySQL
  2.    >update user set passwordpassword=password("new_pass") where user="root";
  3.    >flush privileges;

复制代码


 重新杀 MySQL ,用正常方法启动 MySQL 。

  如果 MySQL 正在运行,首先杀之: killall -TERM MySQLd。

  启动 MySQL :bin/safe_MySQLd --skip-grant-tables & (有时会是MySQLd_safe)

  就可以不需要密码就进入 MySQL 了。

  然后就是 /usr/local/MySQL/bin/MySQL


  1.    >use MySQL
  2.    >update user set passwordpassword=password("new_pass") where user="root";
  3.    >flush privileges;

复制代码

  重新杀 MySQL ,用正常方法启动 MySQL 。
MySQL中遗忘root密码解决方法分享

  以上的相关内容就是对MySQL忘记root的介绍,望你能有所收获。

Tags: 

延伸阅读

最新评论

发表评论