1. Change the password
2. Forgot password
Option 1. Modify the configuration
1. Modify the database configuration file my.cnf and add skip-grant-tables under [mysqld] , save and exit, and restart the mysql service: service mysqld restart
2. Execute the mysql command to enter the mysql command line
3. Modify the root password
MySQL > UPDATE mysql. user SET Password = PASSWORD( ' new password ' ) where USER = ' root ' ; MySQL> flush privileges; MySQL> exit
4. Comment out the skip-grant-tables in my.cnf , and then restart mysql, namely: service mysqld restart