1. Error prompt
2. Modify the MySql configuration file my.cnf and add skip-grant-tables
Search for mysqld to
add skip-grant-tables
, so that mysql can log in without password.
3. Restart the service
View all services
Restart the mysqld service
4. Connect to MySql again and reset the password
Any password can be entered
Switch to mysql database
Reset password
UPDATE user SET password=PASSWORD("root") WHERE user='root';
- 1
5. Modify the configuration file my.cnf, delete skip-grant-tables, restart, and log in again
Delete skip-grant-tables and
restart the service
Log in again
complete!