Advertisement
scriptz-team

[SSH] Change mysql timezone

Jul 8th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. _____ _____ _ _____ _____ _____ _____ _____ _____
  2. ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
  3. |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
  4. |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
  5. |s C R i P T z - T E A M . i N F O|----------------------------
  6.  
  7. - iNfO -
  8.  
  9. [SSH] Change mysql timezone
  10.  
  11. - NOtIcE -
  12.  
  13. After re-nooting you need to do this again!!!
  14.  
  15. The easiest way to do this, as noted by Umar is, for example
  16.  
  17. mysql> SET GLOBAL time_zone = 'America/New_York';
  18.  
  19. Using the named timezone is important for timezone that has a daylights saving adjustment. However, for some linux builds you may get the following response:
  20.  
  21. #1298 - Unknown or incorrect time zone
  22.  
  23. If you're seeing this, you may need to run a tzinfo_to_sql translation... it's easy to do, but not obvious. From the linux command line type in:
  24.  
  25. mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql -u root mysql -p
  26.  
  27. Provide your root password (MySQL root, not Linux root) and it will load any definitions in your zoneinfo into mysql. You can then go back and run your
  28.  
  29. mysql> SET GLOBAL time_zone = timezone; (or in phpmyadmin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement