connection url mysql_连接MySQL错误:create connection SQLException, url: jdbc:mysql://localhost:3306/****...

连接MySQL错误:create connection SQLException, url: jdbc:mysql://localhost:3306/*****?

具体报错如下:

2018-11-12 16:14:21.704 ERROR 9752 --- [eate-1537371824]

com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url:

jdbc:mysql://localhost:3306/*****?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false,

errorCode 1193, state HY000

java.sql.SQLException: Unknown system variable 'query_cache_size'

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2547)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2505)

at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1370)

at

com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3862)

at

com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3290)

at

com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2299)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)

at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:795)

at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:44)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)

at

com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)

at

com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156)

at

com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218)

at

com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150)

at

com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1560)

at

com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1623)

at

com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2468)

解决方法:本人是MySQL版本问题,用的是MySQL8.0,将MySQL驱动改成如下:5.1.6

mysql

mysql-connector-java5.1.6

修改后的连接信息如下:

spring: datasource: type: com.alibaba.druid.pool.DruidDataSource

driverClassName: com.mysql.jdbc.Driver druid: first: #数据源1 url:

jdbc:mysql://localhost:3306/renren_fast?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8

username: ***** password: ***** second: #数据源2 url:

jdbc:mysql://localhost:3306/renren_fast?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8

username: ***** password: *****

........................

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值