忘记mysql密码,怎么办?

1. vim  /etc/my.cnf

  在 [ mysqld]  下面添加一行:

   skip-grant-tables  保存退出

2.killall  mysqld

  命令行 mysql  进入

update  mysql.user  set  authentication_string=password("新密码")   where  user="root" and  host="localhost";

3. flush privileges;

4.exit退出,killall   mysqld  。  vim   /etc/my.cnf     去掉skip-grant-tables  这行,重启。ok

猜你喜欢

转载自blog.csdn.net/wubude/article/details/81122487