博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MYSQL:WARN: Establishing SSL connection without server's identity verification is not recommended
阅读量:2395 次
发布时间:2019-05-10

本文共 1190 字,大约阅读时间需要 3 分钟。

在JDBC连接Mysql数据库的过程中出现了如下的警告信息:

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.

是Mysql数据库的SSL连接问题,提示警告不建议使用没有带服务器身份验证的SSL连接,是在MYSQL5.5.45+, 5.6.26+ and 5.7.6+版本中才有的这个问题。解决办法在警告中已经说明了:

在数据库连接的url中添加useSSL=false;2.url中添加useSSL=true,并且提供服务器的验证证书。如果只是做一个测试的话,没必要搞证书那么麻烦啦,在连接后添加一个useSSL=false即可,例如:

jdbc:mysql://localhost:3306/test?useSSL=false

在使用Java进行JDBC连接的时候,可以在Properties对象中设置useSSL的值为false,但是和写在链接中是一样的。比如

Properties properties = new Properties();properties.setProperty("user", "root");properties.setProperty("password", "milos23);properties.setProperty("useSSL", "false");properties.setProperty("autoReconnect", "true");	try (	Connection conn = DriverManager.getConnection(connectionUrl, properties)	) {
...} catch (SQLException e) {
...}

转载地址:http://auzob.baihongyu.com/

你可能感兴趣的文章
Python往MySQL存储图片
查看>>
Flask-SQlAIchemy管理数据库
查看>>
Flask-Migrate实现数据库迁移
查看>>
su: cannot set user id: Resource temporarily unavailable
查看>>
SSHException: Incompatible ssh peer (no acceptable kex algorithm)
查看>>
shell切换用户
查看>>
session机制详解
查看>>
《算法导论》学习总结——第二部分1堆排序
查看>>
linux下进程的一些总结
查看>>
强大的g++呢还是强大的C++?太假了吧
查看>>
C++中的内联函数inline总结
查看>>
C++中的函数指针的一些总结
查看>>
ubuntu下为postgresql添加ODBC驱动过程
查看>>
linux下的su,su -,以及cd,cd - ,cd ~总结
查看>>
CAS锁为什么是乐观锁呢
查看>>
Argument of type '(Foo::)(int,int)' does not match 'void (*)(int,int)'以及静态函数问题
查看>>
今天遇到的postgresql中的备份和恢复
查看>>
正好碰到了C++的函数对象,查各路资料,总结写下来吧
查看>>
今天试vi遇到的“Sorry,the command is not available in this version : syntax on”
查看>>
今天又搞到个libDTL.so is not an ELF file - it has the wrong magic bytes at the start.
查看>>