0

When i was checking the GMT time here it was 05:40:00, at the same time i ran the below query in mysql,

SET time_zone='+00:00'; // to get GMT time
SELECT NOW();

It was 05:37:50 from above query. So in mysql i am getting around 2 minutes time difference from GMT. It has to give 05:40:00 instead of 05:37:50. How to resolve this?

Thanks for your valuable time.

iLaYa ツ
  • 3,941
  • 3
  • 32
  • 48
  • What does the server computer clock tell you? Is it the same difference (adjusting for the time zone)? – GregD Nov 07 '12 at 05:59
  • @GregD- in server time also i am getting 2 minutes difference. – iLaYa ツ Nov 07 '12 at 06:01
  • Then look at @mvp answer. You need to sync the time between your server and the outside world. What OS are you using? – GregD Nov 07 '12 at 06:02

1 Answers1

1

I cannot reproduce this on my Linux box.

Most likely that machine that MySQL server is running on does not have properly configured time service.

Depending of what OS your MySQL is running, you should setup time sync. For Linux, it would we ntpd package.

mvp
  • 111,019
  • 13
  • 122
  • 148
  • Thanks for your quick reply, can we get the exact GMT time without adjusting the mysql server time. – iLaYa ツ Nov 07 '12 at 06:02
  • I think it is close to impossible to do without having reliable exact time source to begin with. You really should just fix NTP and that would fix all your problems – mvp Nov 07 '12 at 06:04
  • MySQL server takes time from the computer. If you set your computer time correctly - it will solve MySQL time as well. – GregD Nov 07 '12 at 06:05
  • ok fine. I dont have privilege to change the time that's why asked.anyway i'll ask the network admin to change the time. – iLaYa ツ Nov 07 '12 at 06:08