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

su@www:~$ sudo dpkg-reconfigure tzdata
[sudo] password for su:
no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

You will be presented with the following screen. Simply select the region and city and you’re done with this step.

Select region
Select city
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:~$

Now you can sync the clock with a NTP server, and check if the date is OK.

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:~$

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.

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