Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Restarting MySQL fixed that one. Restarting Cron did not –  Tim May 12 '11 at 11:36

2 Answers 2

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

share|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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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