I have my system clock set to UK time, which is currently +0100 (BST) I set this by symlinking the localtime file, as follows

/etc/localtime -> /usr/share/zoneinfo/Europe/London
  • The date command correctly shows the time as +0100.
  • File modification timestamps also treat the time as +0100.

However:

  • MySQL still thinks it's -0400.
  • Cron also thinks it's -0400.

I run a few very similar servers, (CentOS 5 on a VPS) and have not had this problem before. What am I missing here?

link|improve this question

25% accept rate
Restarting MySQL fixed that one. Restarting Cron did not – Tim May 12 '11 at 11:36
feedback

2 Answers

You may have wrong locale settings in your environment. See what's the output of locale.

link|improve this answer
locale gives me this: LANG= LC_CTYPE="POSIX" LC_NUMERIC="POSIX" LC_TIME="POSIX" LC_COLLATE="POSIX" LC_MONETARY="POSIX" LC_MESSAGES="POSIX" LC_PAPER="POSIX" LC_NAME="POSIX" LC_ADDRESS="POSIX" LC_TELEPHONE="POSIX" LC_MEASUREMENT="POSIX" LC_IDENTIFICATION="POSIX" LC_ALL= – Tim May 12 '11 at 11:28
which is identical to another similar VPS that is working fine – Tim May 12 '11 at 11:30
You definitely don't have the correct locale set then. I'd recommend setting it. As to the difference in time, you may add a line to MySQL script and a job to cron to see the output of locale from inside. If they are set to something other than POSIX, this would explain the difference. – PaweÅ‚ Brodacki May 12 '11 at 11:53
From a cronjob, I get the same output. – Tim May 12 '11 at 13:25
I managed to fix MySQL by restarting. restarting cron didn't fix though. – Tim May 12 '11 at 13:26
feedback

Check presence of TZ environment variable. See man tzset for description of its format and how time zone info is defined.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.