mysql5.7 forgotten password recovery linux

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/xiaohe73/article/details/80082017
  1. Open the configuration file with vim mysql /etc/my.cnf (directory in which your own judgment), the [mysqld] followed by a following code. If there is no [mysqld] to add their own
    skip-grant-tables
  2. Restart mysql
    service mysql restart
  3. Log in with a blank password and change the root password mysql
    update user set authentication_string = password ( '这里填新密码' ) where user= 'root' ; 
  4. Open the configuration file mysql my.cnf, remove [mysqld] plus part of the code just behind
  5. Restart mysql
    service mysql restart

Guess you like

Origin blog.csdn.net/xiaohe73/article/details/80082017