天天看点

mysql时区问题设置

在新的Windows环境安装mysql,启动项目后报错:

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.           

报错时区值‘�й���׼ʱ��’不被识别,或该值不是合法的时区值。

解决方案:

在可执行sql环境执行如下sql:

#全局设置时区为东8区,即北京时间
SET GLOBAL time_zone = '+8:00';
或
#仅修改当前会话时区 
SET time_zone = '+8:00';
#立即生效修改
FLUSH PRIVILEGES;           

附:

windows安装mysql