前几天重装系统,把开发需要的所有工具重新装了一遍,完事儿就关电脑嗨皮了。
今天新建项目连库运行后报如下错误:
错误信息:
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.
其实这是安装mysql的时候时区设置的不正确,可以看一下.
DOS登录数据库,执行下面命令:
执行命令:
show variables like '%time_zone%';
安装mysql时候默认的是美国的时区,而我们中国大陆要比他们迟8小时,采用+8:00格式
解决方式:
解决方式一(速效救心丸,可以解决问题,但治标不治本,电脑关机下次开机访问数据库还报这个错):
执行命令:
set global time_zone='+8:00';
解决方式二(标本兼治):
修改mysql的配置文件:
使用notepad或者editplus打开mysql根目录下的my.ini文件,在[mysqld]节点下加入一行:
default-time-zone='+08:00'
如图所示:
保存,重启mysql服务.
这时再次使用dos命令查看mysql的时区设置.
好了。