修改mysql时区

1、查看mysql时区

  show variables like ‘%time_zone%’;

  如果system_time_zone和time_zone 均为UTC,则表示当前时区为英国格林威治中时区即零时区。

  中国北京为东八区比零时区早8小时

2、设置时区

  方法1:

    set global time_zone='+8:00';
    set time_zone='+8:00';
    flush PRIVILEGES;

  方法2:

    修改配置文件 /etc/my.cnf

    default-time_zone = '+8:00'

    

posted @ 2023-05-23 15:28  爪哇不洼  阅读(185)  评论(0编辑  收藏  举报