今天自己做那个秒杀项目时候,开始是好的,一会就出现如上错误
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at sun.reflect.GeneratedConstructorAccessor38.newInstance(Unknown Source) ~[na:na]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
开始是这样的,
jdbc:mysql://127.0.0.1:3306/miaosha?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
然后后修改下连接:
jdbc:mysql://127.0.0.1:3306/miaosha?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
后来还是报错,不过错误不一样了,
2019-10-11 11:02:45.268 ERROR 14300 --- [Create-15070576] com.alibaba.druid.pool.DruidDataSource : create connection error java.sql.SQLException: validateConnection false at com.alibaba.druid.pool.DruidAbstractDataSource.validateConnection(DruidAbstractDataSource.java:1199) ~[druid-1.0.5.jar:1.0.5] at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1422) ~[druid-1.0.5.jar:1.0.5] at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:1649) ~[druid-1.0.5.jar:1.0.5]
然后就修改了连接的版本:
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.0.2</version> </dependency>
就正常了