连接数据库报错:Caused by: : No appropriate protocol的一个解决方法

时间:2024-11-12 11:09:52

控制台报错:

Caused by: : No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
	at .<init>(:171)
	at .<init>(:101)
	at (:238)
	at (:394)
	at (:373)
	at (:316)
	at (:188)
	at (:99)
	at (:331)
	... 13 more
ERROR [Druid-ConnectionPool-Create-2104781626] - create connection error, url: jdbc:mysql://localhost:3306/kcts_trade?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useAffectedRows=true&allowMultiQueries=true, errorCode 0, state 08S01
: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at (:174)
	at (:64)
	at (:827)
	at .<init>(:447)
	at (:237)
	at (:199)
	at (:1464)
	at (:1529)
	at $(:2109)
Caused by: : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at .(Unknown Source)
	at (:45)
	at (:423)
	at (:61)
	at (:105)
	at (:151)
	at (:167)
	at (:340)
	at (:777)
	at (:486)
	at (:202)
	at (:1348)
	at (:163)
	at (:947)
	at (:817)
	... 6 more
Caused by: : No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
	at .<init>(:171)
	at .<init>(:101)
	at (:238)
	at (:394)
	at (:373)
	at (:316)
	at (:188)
	at (:99)
	at (:331)
	... 13 more
ERROR [Druid-ConnectionPool-Create-2104781626] - create connection error, url: jdbc:mysql://localhost:3306/kcts_trade?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useAffectedRows=true&allowMultiQueries=true, errorCode 0, state 08S01
: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at (:174)
	at (:64)
	at (:827)
	at .<init>(:447)
	at (:237)
	at (:199)
	at (:1464)
	at (:1529)
	at $(:2109)
Caused by: : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at .(Unknown Source)
	at (:45)
	at (:423)
	at (:61)
	at (:105)
	at (:151)
	at (:167)
	at (:340)
	at (:777)
	at (:486)
	at (:202)
	at (:1348)
	at (:163)
	at (:947)
	at (:817)
	... 6 more
Caused by: : No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
	at .<init>(:171)
	at .<init>(:101

我的解决方法:
在连接的后面加上 useSSL=false

 url: jdbc:mysql://localhost:3306/demo1?useUnicode=true&useSSL=false&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useAffectedRows=true&allowMultiQueries=true