Set the timezone in MySQL or MariaDB permanent
Check the current timezone
-- At session level
select @@session.time_zone;
--At Server level
Change the timezone at the session level
set @@session.time_zone = 'America/Los_Angeles';
set @@session.time_zone = '-7:00';
Check the global timezone
The global setting is used by all sessions
select @@global.time_zone;
Set the global time zone
set @@global.time_zone = '+3:00';
For permanent effect, you need to modify the parameter in the my.cnf or my.ini file and restart the MySQL or MariaDB database
Like:
[mysqld]
...
default-time-zone='-06:00'
OR
default-time-zone='America/Los_Angeles'
--Restart the Services
Pingback: How to change timezone in MySQL or MariaDB in parameters – CongNghe