I realized that some of my droplets in Digital Ocean have different timezone between OS and MySQL. By default, I've configured all vms to Brazilian timezone (America/Sao_Paulo) through tzselect
, and, assuming that MySQL comes using default timezone as of system.
So, when I type for current timestamp, I get this from CentOS:
date
Thu Jun 9 09:43:03 BRT 2016
and from MySQL:
mysql> select current_timestamp;
+---------------------+
| current_timestamp |
+---------------------+
| 2016-06-09 12:45:57 |
+---------------------+
1 row in set (0.00 sec)
mysql>
Reading docs of MySQL 5.5, I have option to use timezone as string, as 'America/Sao_Paulo'
for instance, however, CentOS 6.5 comes with MySQL 5.1, and it doesn't has the same option, only using hours, as +3:00 ...I'm sure that I guess I should not worry about date/time of MySQL since I've configured it on system.
CentOS configs for timezone that I did:
I've used tzselect
command to set Brazilian timezone, thinking that MySQL will assume this configuration. After reboot, I realize that system erase my configs on tzselect, to prevent this, I put this line at /etc/rc.local
:
ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
Even if this configs, I realize some vms are as UTC e some others with BRT...and at this moment, I really don't know how I'll configure all my servers, at least 40 machines, with same way.
Does someone can help me explaining how can I correctly set timezone for system a also for MySQL?
Additional Infos
System: CentOS 6.5 x64 MySQL: 5.1 (default)
Below, command asked by @lese:
mysql> SELECT @@global.time_zone, @@session.time_zone;
+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| SYSTEM | SYSTEM |
+--------------------+---------------------+
1 row in set (0.00 sec)
mysql> select current_timestamp;
+---------------------+
| current_timestamp |
+---------------------+
| 2016-06-09 14:31:19 |
+---------------------+
1 row in set (0.00 sec)
mysql> exit
Bye
$ date
Thu Jun 9 11:31:22 BRT 2016
And machine time at /etc/sysconfig/clock
file:
[root@xxxx]# cat /etc/sysconfig/clock
ZONE=Etc/UTC
Best regards.
/etc/my.cnf
?