MySql 数据库连接问题Unable to create initial connections of pool.

时间:2024-10-30 16:23:55

MySql无法连接数据库

我的LOG如下:

2018-03-29 13:56:57.023 ERROR 5084 --- [           main]       : Unable to create initial connections of pool.

.: Communications link failure

The last packet successfully received from the server was 12 milliseconds ago.  The last packet sent successfully to the server was 11 milliseconds ago.
	at .newInstance0(Native Method) ~[na:1.8.0_121]
	at (:62) ~[na:1.8.0_121]
	at (:45) ~[na:1.8.0_121]
	at (:423) ~[na:1.8.0_121]
	at (:425) ~[mysql-connector-java-5.1.:5.1.45]
	at (:990) ~[mysql-connector-java-5.1.:5.1.45]
	at (:203) ~[mysql-connector-java-5.1.:5.1.45]
	at (:4901) ~[mysql-connector-java-5.1.:5.1.45]
	at (:1659) ~[mysql-connector-java-5.1.:5.1.45]
	at (:1226) ~[mysql-connector-java-5.1.:5.1.45]
	at (:2188) ~[mysql-connector-java-5.1.:5.1.45]
	at (:2219) ~[mysql-connector-java-5.1.:5.1.45]
	at (:2014) ~[mysql-connector-java-5.1.:5.1.45]
	at .<init>(:776) ~[mysql-connector-java-5.1.:5.1.45]
	at .JDBC4Connection.<init>(:47) ~[mysql-connector-java-5.1.:5.1.45]
	at .newInstance0(Native Method) ~[na:1.8.0_121]
	at (:62) ~[na:1.8.0_121]
	at (:45) ~[na:1.8.0_121]
	at (:423) ~[na:1.8.0_121]
	at (:425) ~[mysql-connector-java-5.1.:5.1.45]
	at (:386) ~[mysql-connector-java-5.1.:5.1.45]
	at (:330) ~[mysql-connector-java-5.1.:5.1.45]
	at (:310) ~[tomcat-jdbc-8.5.:na]
	at (:203) ~[tomcat-jdbc-8.5.:na]
	at (:735) [tomcat-jdbc-8.5.:na]
	at (:667) [tomcat-jdbc-8.5.:na]
	at (:482) [tomcat-jdbc-8.5.:na]
	at .<init>(:154) [tomcat-jdbc-8.5.:na]
	at (:118) [tomcat-jdbc-8.5.:na]
	at (:107) [tomcat-jdbc-8.5.:na]
	at (:131) [tomcat-jdbc-8.5.:na]
	at (:122) [hibernate-core-5.0.:5.0.]
	at $(:180) [hibernate-core-5.0.:5.0.]
	at (:68) [hibernate-core-5.0.:5.0.]
	at (:35) [hibernate-core-5.0.:5.0.]
	at (:88) [hibernate-core-5.0.:5.0.]
	at (:254) [hibernate-core-5.0.:5.0.]
	at (:228) [hibernate-core-5.0.:5.0.]
	at (:207) [hibernate-core-5.0.:5.0.]
	at (:51) [hibernate-core-5.0.:5.0.]
	at (:94) [hibernate-core-5.0.:5.0.]
	at (:237) [hibernate-core-5.0.:5.0.]
	at (:207) [hibernate-core-5.0.:5.0.]
	at (:352) [hibernate-core-5.0.:5.0.]
	at (:111) [hibernate-core-5.0.:5.0.]
	at (:847) [hibernate-entitymanager-5.0.:5.0.]
	at (:874) [hibernate-entitymanager-5.0.:5.0.]
	at (:60) [spring-orm-4.3.:4.3.]
	at (:360) [spring-orm-4.3.:4.3.]
	at (:382) [spring-orm-4.3.:4.3.]
	at (:371) [spring-orm-4.3.:4.3.]
	at (:336) [spring-orm-4.3.:4.3.]
	at (:1687) [spring-beans-4.3.:4.3.]
	at (:1624) [spring-beans-4.3.:4.3.]
	at (:555) [spring-beans-4.3.:4.3.]
	at (:483) [spring-beans-4.3.:4.3.]
	at $(:306) [spring-beans-4.3.:4.3.]
	at (:230) [spring-beans-4.3.:4.3.]
	at (:302) [spring-beans-4.3.:4.3.]
	at (:197) [spring-beans-4.3.:4.3.]
	at (:1080) [spring-context-4.3.:4.3.]
	at (:857) [spring-context-4.3.:4.3.]
	at (:543) [spring-context-4.3.:4.3.]
	at (:122) [spring-boot-1.5.:1.5.]
	at (:693) [spring-boot-1.5.:1.5.]
	at (:360) [spring-boot-1.5.:1.5.]
	at (:303) [spring-boot-1.5.:1.5.]
	at (:1118) [spring-boot-1.5.:1.5.]
	at (:1107) [spring-boot-1.5.:1.5.]
	at (:9) [classes/:na]
Caused by: : : : Path does not chain with any of the trust anchors
	at (:192) ~[na:1.8.0_121]
	at (:1949) ~[na:1.8.0_121]
	at (:302) ~[na:1.8.0_121]
	at (:296) ~[na:1.8.0_121]
	at (:1514) ~[na:1.8.0_121]
	at (:216) ~[na:1.8.0_121]
	at (:1026) ~[na:1.8.0_121]
	at .process_record(:961) ~[na:1.8.0_121]
	at (:1062) ~[na:1.8.0_121]
	at (:1375) ~[na:1.8.0_121]
	at (:1403) ~[na:1.8.0_121]
	at (:1387) ~[na:1.8.0_121]
	at (:188) ~[mysql-connector-java-5.1.:5.1.45]
	... 63 common frames omitted
Caused by: : : Path does not chain with any of the trust anchors
	at $(:304) ~[mysql-connector-java-5.1.:5.1.45]
	at (:984) ~[na:1.8.0_121]
	at (:1496) ~[na:1.8.0_121]
	... 71 common frames omitted
Caused by: : Path does not chain with any of the trust anchors
	at (:153) ~[na:1.8.0_121]
	at (:79) ~[na:1.8.0_121]
	at (:292) ~[na:1.8.0_121]
	at $(:297) ~[mysql-connector-java-5.1.:5.1.45]
	... 73 common frames omitted

我的环境是:

<dependency>
    <groupId></groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

我的MySql服务器是在CentOS7,版本是:Server version: 5.7.20 MySQL Community Server (GPL)

我的如下:

=jdbc:mysql://192.168.55.130:3306/mes?characterEncoding=utf8&useSSL=true&autoReconnect=false&rewriteBatchedStatements=true

解决办法:

将useSSL=true改为useSSL=false

只能说明服务器没有打开SSL功能。