昨天将mysql版本从5.5改成5.7版本,然后运行程序的时候出现了以下错误:
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.
解决办法:
在mysql连接字符串url中加入ssl=true或者false即可,如下所示。
private static final String url = "jdbc:mysql://localhost:3306/Book?characterEncoding=utf-8&useSSL=true";
在IntelliJ IDEA中 “&” 被当成了特殊符号,需要转义。