2

I want to setup time_zone for some other time zone different than that of my system like (GMT - 7:00). I tried

SET  time_zone  =  '-07:00';

But this changed it just for a MYSQL Session and is not permanent as the time_zone returns back to system time_zone after i restart mysql service.

muru
  • 207,970

1 Answers1

4

I think you can retrieve the server and client time_zone settings:

SELECT @@global.time_zone, @@session.time_zone;

You can also change the client timezone, or the timezone for the entire MySQL instance.

If you have server time_zone set at MySQL instance startup, you can modify the /etc/my.cnf file (or wherever your mysql instance initialization parameters are read from), under the [mysqld] section:

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

-- or --

add the --default_time_zone='+00:00' option to mysqld_safe

WIth Each client session can change the timezone setting for their own session:

mysql> SET GLOBAL time_zone = 'Asia/Tokyo';

(Or whatever time zone GMT+1 is.: http://www.php.net/manual/en/timezones.php)

This is the command to set the MySQL timezone for an individual client, assuming that your clients are spread accross multiple time zones.

Kotler
  • 609