由于MYSQL最新版的加密方式有所不同,要换最新版的JDBC mysql-connector-java-8.0.11.jar 和使用最新版的C3P0 :
c3p0-0.9.5.2.jar 还有MYSQL的密码方式设置成 mysql_native_password
使用eclipse的话还需要额外导入个包 mchange-commons-java-0.2.15.jar
附上我的c3p0-config.xml配置
com.mysql.cj.jdbc.Driver 这是新版本的驱动加载方式
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<default-config>
<property name="driverClass">com.mysql.cj.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=Hongkong&characterEncoding=utf-8&autoReconnect=true</property>
<property name="user">root</property>
<property name="password">root</property>
<property name="initialPoolSize">10</property>
<property name="minPoolSize">10</property>
<property name="maxPoolSize">20</property>
</default-config>
<!-- This app is massive! -->
<!-- <named-config name="oracle">
<property name="driverClass">com.mysql.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql:///web_test4</property>
<property name="user">root</property>
<property name="password">abc</property>
</named-config> -->
</c3p0-config>