Answer the question
In order to leave comments, you need to log in
Wrong time zone in MySQL?
In MySQL, the time is one hour behind than in the system. Why is not clear.
The problem manifested itself only on 1 server with the following configuration:
OS - Debian GNU/Linux 6.0.3 (squeeze)
MySQL - 5.1.49
The current time and time zone are correctly configured in the system:
$ date<br/>
Mon Nov 7 16:49:10 MSK 2011
# apt-cache policy tzdata<br/>
tzdata:<br/>
Installed: 2011m-0squeeze1<br/>
Candidate: 2011m-0squeeze1<br/>
Version table:<br/>
*** 2011m-0squeeze1 0<br/>
500 <a href="http://mirror.yandex.ru/debian/">mirror.yandex.ru/debian/</a> squeeze-updates/main amd64 Packages<br/>
100 /var/lib/dpkg/status<br/>
2011k-0squeeze1 0<br/>
500 <a href="http://mirror.yandex.ru/debian/">mirror.yandex.ru/debian/</a> squeeze/main amd64 Packages
mysql> select NOW();<br/>
+---------------------+<br/>
| NOW() |<br/>
+---------------------+<br/>
| 2011-11-07 15:49:10 |<br/>
+---------------------+<br/>
1 row in set (0.00 sec)
mysql> SELECT @@global.time_zone, @@session.time_zone;<br/>
+--------------------+---------------------+<br/>
| @@global.time_zone | @@session.time_zone |<br/>
+--------------------+---------------------+<br/>
| SYSTEM | SYSTEM |<br/>
+--------------------+---------------------+<br/>
1 row in set (0.00 sec)
mysql> SHOW GLOBAL VARIABLES LIKE '%time_zone%';<br/>
+------------------+--------+<br/>
| Variable_name | Value |<br/>
+------------------+--------+<br/>
| system_time_zone | MSD |<br/>
| time_zone | SYSTEM |<br/>
+------------------+--------+<br/>
2 rows in set (0.00 sec)
Answer the question
In order to leave comments, you need to log in
Hmm, the same version of OS and MySQL, but everything is fine - system_time_zone issues MSK.
Here is another tzdata
Now it will even be somehow scary to be updated :-/
apt-cache policy tzdata
tzdata:
Установлен: 2011k-0squeeze1
Кандидат: 2011k-0squeeze1
Таблица версий:
*** 2011k-0squeeze1 0
500 mirror.hetzner.de/debian/packages/ squeeze/main amd64 Packages
500 ftp.uni-bayreuth.de/linux/Debian/debian/ squeeze/main amd64 Packages
100 /var/lib/dpkg/status
Restart the service after updating tzdata. I also had less time on FreeBSD than on the system. saved
#service mysql-server restart
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question