MariaDB SSL连接错误:不支持的记录版本Unknown-0.0

时间:2019-04-12 02:35:49

标签: ssl jdbc mariadb

我的环境:

OS: centos 7.6.1810
database: 10.3.14-MariaDB
jdbc driver: mariadb-java-client 2.4.1
jdbc parameter: jdbc:mysql://db_ip:3306/dbname?useUnicode=true&characterEncoding=utf8mb4&useSSL=true&trustServerCertificate=true
java: openjdk version "1.8.0_201"
ap server: wildfly 16

MariaDB SSL配置在下面进行了测试:

mysql mysql --ssl

MariaDB [mysql]> status
--------------
mysql  Ver 15.1 Distrib 10.3.14-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:          68
Current database:       mysql
Current user:           root@localhost
SSL:                    Cipher in use is DHE-RSA-AES256-GCM-SHA384
Current pager:          less
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         10.3.14-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 24 min 1 sec

当我尝试使用jdbc建立与mariadb的ssl连接时,出现以下异常:

Caused by: javax.net.ssl.SSLException: Unsupported record version Unknown-0.0
        at sun.security.ssl.InputRecord.checkRecordVersion(InputRecord.java:552)
        at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:565)
        at sun.security.ssl.InputRecord.read(InputRecord.java:529)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
        at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:437)
        ... 87 more

jdbc驱动程序应该是最新版本,在将mariadb升级到10.3.14之前,它已经可以工作了,我已经尝试了几种jdbc驱动程序版本,但是没有一个起作用。我应该怎么解决这个问题。

0 个答案:

没有答案