赞
踩
- 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.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_181]
- at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_181]
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_181]
- at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_181]
解决的方法异常信息里已经给出: 配置server或者JDBC驱动来指定时区
jdbc:mysql://127.0.0.1:3306/local?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
实际是把GMT+8(北京时间)作为参数传递, 也可以传入Linux中的timezone (Asia/Shanghai)...
- --查看当前server时区
- SHOW VARIABLES LIKE '%time_zone%';
-
- --设置全局时区为北京时间
- SET GLOBAL time_zone='+8:00';
-
- --设置当前session时区为北京时间
- SET time_zone='+8:00';
Windows -- my.ini
Linux -- my.cnf
在配置文件中加上
default-time_zone = '+8:00'
(注意:修改配置文件不是立即生效, 添加参数后需要重启mysql服务(进程))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。