如何在Java中连接到SQL数据库时禁用WARN

Eth*_*ore 9 java mysql ssl

在我正在编程的Java应用程序中,当我要求程序从SQL数据库中检索数据时,它会在控制台中显示:

Wed Apr 20 16:57:58 MDT 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. 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.

我知道这是很多东西,我在SQL工作台中禁用了SSL,所以我无法弄清楚如何摆脱警告或者我是否应该关注它?提前致谢.

gee*_*eek 22

尝试在连接字符串中使用useSSL = false

例:

JDBC:MySQL的:// XXXXXXX:3306/XXXX autoReconnect的=真useSSL = FALSE

  • @EthanMoore 仅仅因为你想出了正确的答案并不意味着你应该删除它,它可以对其他人派上用场。谢谢... (2认同)