mysql-connector-java-8.0.22连接出现的问题
- create connection SQLException, url: jdbc:mysql://localhost:3306/test, errorCode 1045, state 28000
- 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 specific time zone value if you want to utilize time zone support
今天在使用mysql-connector-java-8.0.22出现了新问题,于是写了一遍博客记录一下。
create connection SQLException, url: jdbc:mysql://localhost:3306/test, errorCode 1045, state 28000
这个问题的产生是因为配置文件中字段与Mysql关键字冲突,只需要在username,password,driverclass,url加个前缀
比如:
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 specific time zone value if you want to utilize time zone support
这个问题是因为mysql8.x的jdbc升级了,增加了时区(serverTimezone)属性,并且不允许为空。
所以只要在配置文件的url中后面添加serverTimezone的属性。如下:
prop.url=jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Shanghai