9

I am using default_time_zone='+00:00' in my.conf file and restart mysql server. But again default time zone is showing SYSTEM.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Ankit Kumar
  • 393
  • 2
  • 3
  • 18

2 Answers2

21

In my.conf file, try:

[mysqld]
...
# default_time_zone='+00:00'
default-time-zone=+00:00
...

Documentation: 5.1.3. Server Command Options: --default-time-zone=timezone

wchiquito
  • 16,177
  • 2
  • 34
  • 45
  • 2
    Yes this is correct. and add this line default-time-zone=+00:00 under [mysqld] section then it will work. – Ankit Kumar Nov 11 '13 at 12:36
  • 2
    Is it possible to use timezones instead of time offsets? Like `AEDT` or `Australia/Sydney`? – kev Dec 07 '17 at 06:20
  • @kev: See [10.6 MySQL Server Time Zone Support](https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html). – wchiquito Dec 07 '17 at 06:27
  • I read it, doesn't help, hence I asked here (where you commented already): https://stackoverflow.com/questions/47688434/where-to-set-time-zone-in-mysql-5-7-config-files. It doesn't mention sections at all and doesn't explain the error messages I am getting. – kev Dec 07 '17 at 06:28
  • @kev Named time zones can be used only if the time zone information tables in the mysql database have been created and populated. https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html#time-zone-installation – RenRen Mar 21 '19 at 08:56
7

I use Ubuntu so on my machine location of the config file is:

/etc/mysql/mysql.conf.d/mysqld.cnf

add the value:

default_time_zone='+00:00'
IKo
  • 4,998
  • 8
  • 34
  • 54
  • 2
    Hello, afterwards, I also had to do: "sudo service mysql restart" for the update to take effect. Hope this helps. Thank you! Peace. – masarapmabuhay Feb 19 '18 at 07:50