Show pageOld revisionsBacklinksExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Change timezone on Ubuntu server ====== I have a virtual machine somewhere, where i host a web application. I had to change the time zone since the time stamps in MySql were wrong. Here is how to do it without installing a GUI:First, start the TUI time management tool <code bash> su@www:~$ sudo dpkg-reconfigure tzdata [sudo] password for su: no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory </code> You will be presented with the following screen. Simply select the region and city and you’re done with this step. [{{ :linux:ubuntu:timezone1.png?600 |Select region}}] [{{ :linux:ubuntu:timezone2.png?600 |Select city}}] <code bash> Current default time zone: 'Europe/Zagreb' Local time is now: Wed Apr 15 09:50:03 CEST 2015. Universal Time is now: Wed Apr 15 07:50:03 UTC 2015. su@www:~$ </code> Now you can sync the clock with a NTP server, and check if the date is OK. <code bash> su@www:~$ sudo ntpdate zg1.ntp.carnet.hr 15 Apr 10:00:24 ntpdate[46331]: step time server 161.53.123.5 offset 27.628667 sec su@www:~$ date Wed Apr 15 10:00:27 CEST 2015 su@www:~$ </code> Now, the only thing I had to do was to restart my MySql server – which was set to use system time zone as its time zone. You can check which time zone is set in MySql by selecting @@global.time_zone. <code bash> su@www:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 109732 Server version: 5.5.41-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SELECT @@global.time_zone, @@session.time_zone; +--------------------+---------------------+ | @@global.time_zone | @@session.time_zone | +--------------------+---------------------+ | SYSTEM | SYSTEM | +--------------------+---------------------+ 1 row in set (0.02 sec) mysql> </code> You can also leave the system time zone as is, and change the MySql time zone to something different than SYSTEM by using any of these: <code bash> SET GLOBAL time_zone = '+1:00'; SET GLOBAL time_zone = 'Europe/Zagreb'; SET @@global.time_zone='+02:00'; </code> linux/ubuntu/time_zone.txt Last modified: 2019/10/31 09:05by 127.0.0.1