The difference between Mysql8.0 installation and Mysql5.7

The new server is installed with ubuntu20.04. When installing mysql, the default is mysql8.0, and some problems are encountered. Not to mention the process of using apt install mysql , after the installation is completed, we need to change the root password and open root to log in remotely. This time it will be somewhat different from the mysql5.7 modification.

1. The commands used are different. IDENTIFIED BY 'pwd' needs to be removed.

mysql5.7: 

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'  IDENTIFIED BY '密码'  WITH GRANT OPTION;

mysql8.0:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'  WITH GRANT OPTION;

2. It is necessary to modify the plug-in used by root. Solve the problem that Navicat cannot be remote .

mysql5.7: The default is    mysql_native_password

mysql8.0: cache_sha2_password is used by default  

Use the command to modify:

UPDATE user SET plugin='mysql_native_password' WHERE user='root';

ALTER USER root IDENTIFIED WITH mysql_native_password BY '密码';

If you change mysql_native_password  to caching_sha2_password  ,  it will not work . Navicat does not support it yet, at least not in 12.1.22. Likewise, mysql cannot be connected remotely. If you only do the first step without doing the second step, you will also be unable to connect remotely. 

3. The two updated user passwords are also different.

mysql5.7: 

update user set authentication_string=PASSWORD('密码') where User='root';

mysql8.0:  

ALTER USER root IDENTIFIED WITH mysql_native_password BY '密码';

The above are the problems encountered when using mysql8.0. I hope it can help everyone! If you have any questions, please leave a message.

Guess you like

Origin blog.csdn.net/saperliu/article/details/112238888