Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/xiaohe73/article/details/80082017
- 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
- Restart mysql
service mysql restart
- Log in with a blank password and change the root password mysql
update user set authentication_string = password ( '这里填新密码' ) where user= 'root' ;
- Open the configuration file mysql my.cnf, remove [mysqld] plus part of the code just behind
- Restart mysql
service mysql restart