mysql8.0后,发现再用JDBC连接就频频出问题,在网上查了一些,总结如下。
1.驱动程序包肯定要升级到8以上。
2.JDBC连接驱动变为"com.mysql.cj.jdbc.Driver"
。
3.接下来的提示比较明显
According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
于是就在url添加useSSL=false
。
4.最后一个在url加serverTimezone=GMT
。更改时区
end