Before, my MySQL database driver mysql-connector-java version number was 5.1.34. After upgrading to version 8.0.9-rc, I found that the original connection method reported an error. Therefore, record the connection usage of the new version of MySQL database driver here.
First post the connection method of the previous old version (5.1.34):
db.driverClassName=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8&useSSL=true
The connection method of the upgraded new version is as follows:
db.driverClassName=com.mysql.cj.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=GMT
Here, there are two main modifications made after the upgrade:
- First, the database-driven connection address has been
com.mysql.jdbc.Driver
upgraded from the previous onecom.mysql.cj.jdbc.Driver
. - Second, add the time zone to the url address of the database at the end, that is, add it
&serverTimezone=GMT
.