For the problem of establishing SSL connection in mysql, set usessl = false to explicitly disable SSL, or set usessl = true

you need either to explicitly disable ssl by setting usessl=false, or set usessl=true and provide trustsore for server certificate verification

Warning: it is not recommended to establish an SSL connection without server authentication. According to the requirements of MySQL 5.5.45 +, 5.6.26 + and 5.7.6 +, if no explicit option is set, SSL connection must be established by default. To match existing applications that do not use SSL, the verifyservercertificate property is set to “false.”. You need to explicitly disable SSL by setting usessl = false, or set usessl = true and provide a trust store for server certificate verification

Processing method
the first processing method
JDBC URL= jdbc:mysql :// localhost:3306/zht?useUnicode=true& amp; characterEncoding=utf-8& amp; Usessl = false
1. First change the version of MySQL connector java to below 5.5.45
2. Then change the JDBC URL to the following

jdbcUrl= jdbc:mysql :// localhost:3306/zht?useUnicode=true& amp; Characterencoding = UTF-8
the second method
if you prefer the version after 5.5.45, you need to replace the JDBC URL in with a new one:

jdbc:mysql :// fz?useUnicode=true& characterEncoding=UTF8& autoReconnect=true& zeroDateTimeBehavior=convertToNull

Parameter name parameter description
user database user name (used to connect database)
password user password (used to connect database)
whether useunicode uses Unicode character set. If the parameter characterencoding is set to GB2312 or GBK, the parameter value must be set to true
characterencoding. When useunicode is set to true, the character encoding is specified. For example, it can be set to GB2312 or GBK
autoreconnect. When the database connection is interrupted abnormally, do you want to re connect automatically
does autoreconnectforpools use the reconnection policy for database connection pool
after the automatic reconnection is successful, is the connection set to read-only<
when maxreconnects autoreconnect is set to true, the number of times the connection is retried
when initialtimeout autoreconnect is set to true, the time interval between two reconnections, unit: seconds
the connection timeout and the timeout when the database server establishes a socket connection, unit: milliseconds. 0 means never timeout, applicable to JDK 1.4 and higher
socketimeout socket operation (read/write) timeout, unit: Ms. 0 means never time out

Similar Posts: