0

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?

Tim
  • 584
  • 2
  • 9
  • 20

2 Answers2

0

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

Paweł Brodacki
  • 6,511
  • 20
  • 23
  • 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
0

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

AlexD
  • 8,747
  • 2
  • 29
  • 38