Check the current timezone from MySQL:
SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP);
![Change the Timezone for MySQL image 3 - Change the Timezone for MySQL](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/12/image-3.png?resize=454%2C111&ssl=1)
OR
select now();
![Change the Timezone for MySQL image 7 - Change the Timezone for MySQL](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/12/image-7.png?resize=603%2C323&ssl=1)
To check where the timezone is loaded from use:
SELECT @@session.time_zone;
SELECT @@global.time_zone;
![Change the Timezone for MySQL image 4 - Change the Timezone for MySQL](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/12/image-4.png?resize=372%2C230&ssl=1)
If it is set to SYSTEM then it is using either timezone defined inside the my.cnf file or from the OS.
Check my.cnf:
grep time /etc/my.cnf
![Change the Timezone for MySQL image 6 - Change the Timezone for MySQL](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/12/image-6.png?resize=304%2C35&ssl=1)
Check OS timezone:
date
![Change the Timezone for MySQL image 5 - Change the Timezone for MySQL](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/12/image-5.png?resize=231%2C33&ssl=1)
You can set a different timezone on the OS and it will apply to mysqld after service restart, or to use different timezones for OS and for MySQL, set:
SET GLOBAL time_zone = '+8:00';
SET GLOBAL time_zone = 'Europe/Helsinki';
SET @@global.time_zone = '+00:00';
SET @@session.time_zone = "+00:00";
*Replace +8:00 and Europe/Helsinki with your timezone.
to make the changes permanent:
nano /etc/my.cnf
and under [mysqld] section add:
default-time-zone = "+00:00"
save the file and restart mysqld service.