- Open the mysql folder, find the /etc/my.cnf configuration file, add skip-grant-tables at the end of /etc/my.cnf, save it, and skip authentication.
- Restart MySql to make the modified configuration take effect.
- Enter mysql at the terminal, and then enter use mysql;
- Terminal input update mysql.user set authentication_string=password('123456') where user='root';
- Remove skip-grant-tables at the end of /etc/my.cnf and save.
- Restart MySql, enter mysql -u root -p in the terminal, and then follow the prompts to enter the password you just set to use it normally.
Shock! He forgot the mysql password under Linux
Guess you like
Origin blog.csdn.net/mrliqifeng/article/details/71177419
Ranking