CentOS 8.3 cannot log in to the management database after MySQL 8.0.21 is installed

Time:2021-12-1

The solution steps are summarized as follows:

1) Edit the MySQL configuration file to allow login without password:

 vim /etc/my.cnf 

Add the following to the configuration file:

[mysqld]
bind-address=0.0.0.0
skip-grant-tables

 

2) Restart mysqld to make the configuration effective:

systemctl restart mysqld 

 

3) Enter the MySQL command line interactive mode, reset the permission and set the new password:

mysql -uroot -p

mysql>use mysql;
mysql>flush privileges;
mysql>UPDATE user SET authentication_ string="" WHERE user="root";    // First set the root password to empty
mysql>flush privileges;
mysql>ALTER user 'root'@'localhost' IDENTIFIED BY ' [email protected] ';    // Reset password. Note: mysql8 seems to require that it must include case, numbers and special characters. The password format must meet the requirements, otherwise an error will be reported

 

 

4) After quit exits the MySQL interactive mode, edit the configuration file / etc / my.cnf to remove the previously added skip grant tables

 

5) Restart mysqld to use the newly reset password to log in to MySQL interactively in the background!

Recommended Today

Low code industries are surging. What do they rely on to become the first camp in the world?

Gartner released the Magic Quadrant report for enterprise low code application platforms in 2020, which mainly explains the market share, supplier status and future development trend of the low code industry in detail. This report swept the IT circle and refreshed people’s understanding of low code again. In this screen swiping discussion, many people were […]