After the upgrade from MySQL 5.5.25 to 8.0.12 to address a number of issues

The MySQL database is upgraded from 5.5.25 to 8.0.12 encountered several problems, recorded as follows:

After the database is installed, import the original data, start tomcat, error unable to load authentication caching_sha2_plugin, the solution is as follows:

  ALTER USER 'root' @ 'localhost ' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; # modify the encryption rule
  'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'password' ALTER USER; # update about the user's password

  FLUSH PRIVILEGES; # refresh permission

Internet also has said that by modifying my.ini, adding

[mysqld]
default_authentication_plugin=mysql_native_password

After my test, unsuccessful, I do not know why.

https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-versions.html

Connector/J version JDBC version MySQL Server version JRE Supported jDK Required for Compilation Status
8.0 4.2 5.6, 5.7, 8.0 1.8.x  1.8.x  General availability. Recommended version.
5.1 3.0, 4.0, 4.1, 4.2 5.6*, 5.7*, 8.0* 1.5.x, 1.6.x, 1.7.x, 1.8.x* 1.5.x and 1.8.x General availability

The figure shows more than 8.0 connector drive requires JDK1.8 support, 5.1.x version of the driver also supports 8.0. * Mysql, and then download a newer mysql-connector-java-5.1.46 (originally 5.1.21 ), tomcat start again, without being given!

When the project is running for some time, another error:

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

Online search a bit, meaning open ONLY_FULL_GROUP_BY SQL mode by default after the release of 5.7, can cause this problem, modify the my.ini, adding

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

That is, remove sql_mode in ONLY_FULL_GROUP_BY, and then restart mysql, restart TOMCAT, normal operation of the project.

Online said through set @@ sql_mode = 'STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION' modify global settings, I tested and can not succeed, some say global setting is only effective on the later of the new database. I did not verify. There is to know, please leave a message!

Conclusion is: a production environment, do not easily change the version!

Guess you like

Origin www.linuxidc.com/Linux/2019-09/160508.htm