mysql5.7忘记密码找回 linux

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaohe73/article/details/80082017
  1. 用vim打开mysql配置文件/etc/my.cnf(在哪个目录请自行判断),在[mysqld]后面加上一句以下代码。若没有[mysqld]就自已加上
    skip-grant-tables
  2. 重启mysql
    service mysql restart
  3. 用空密码登录并修改mysql的root密码
    update user set authentication_string = password ( '这里填新密码' ) where user= 'root' ; 
  4. 打开mysql配置文件my.cnf,去掉[mysqld]后面刚才加上的那段代码
  5. 重启mysql
    service mysql restart

猜你喜欢

转载自blog.csdn.net/xiaohe73/article/details/80082017