Changing the connection timezone in MySQL

前端 未结 6 725
情话喂你
情话喂你 2020-12-28 14:07

My server is running in MDT

So I used following one to convert EST

SET  time_zone = \'-5:00\'

But, how c

6条回答
  •  温柔的废话
    2020-12-28 15:06

    In case of Mysql8 and want to set EDT timezone 'America/New_York' then follow the below steps:

    1. Go to the /etc/my.cnf
    2. Add this under [mysqld] default-time-zone='America/New_York'
    3. systemctl restart mysqld

    If you face the issue realted fatal error like this:

    Fatal error: Illegal or unknown default time zone
    

    Then do the following steps:

    1. first remove the entry from /etc/my.cnf file for default-time-zone='America/New_York'

    2. Go to shell(exit from mysql) and run the command

      $ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
      
    3. Add the line again

    4. Restart mysql

提交回复
热议问题