JAVA连接JDBC错误: java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone.
完整错误如下
java.sql.SQLException: 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.
java.sql.SQLException:服务器时区值' й '无法识别或代表多个时区。 如果要使用时区支持,则必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)以使用更具体的时区值。
解决方法:修改MySQ的L时区
打开cmd进去MySQL ,输入下面4行代码即可
select curtime(); ##查看MySQL当前时间,当前时区
set global time_zone = '+8:00'; ##修改MySQL全局时区为东8区的北京时间
set time_zone = '+8:00'; ##修改当前会话时区
flush privileges; ##立即生效

共有 0 条评论