IDAE下JDBC链接数据库报错 **The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized..*

IDAE下JDBC链接数据库报错

The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized…

报错: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设置时区与当前电脑系统时区不符,需要手动修改时区为(中国)东八区“+8:00”.

IDAE下JDBC链接数据库报错 **The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized..*_第1张图片

然后查看当前时区(show variables like “%time_zone%”)
IDAE下JDBC链接数据库报错 **The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized..*_第2张图片

system_time_zone 为空表示当前mysql时间与系统一致,time_zone为SYSTEM表示当前使用的时区为SYSTEM时区

最后将时区更改为现在所在时区(东八区)
<1>set time_zone="+8:00"; 只能修改当前会话窗口的时区,关闭即还原

IDAE下JDBC链接数据库报错 **The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized..*_第3张图片
<2>set global time_zone="+8:00"; 修改全局时区,永久有效
在这里插入图片描述

方法二:
在自己编写的java代码连接mysql语句的url后面添加?useSSL=true&serverTimezone=UTC即可解决该代码报错问题
在这里插入图片描述
方法三:
找到mysql的安装路径,然后在mysql-8.0.19-winx64里面找到my.ini

打开my.ini,找到mysqld,在mysqld下面输入default-time-zone = '+8:00’点击保存,最后重启mysql服务即可

IDAE下JDBC链接数据库报错 **The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized..*_第4张图片

你可能感兴趣的:(mysql)