Check current MySQL timezone:
SELECT @@global.time_zone, @@session.time_zone;The value might be SYSTEM, UTC, or your current MySQL timezone.
If you want to change the default MySQL timezone to something else (e.g Asia/Jakarta), run this query:
SET GLOBAL time_zone = 'Asia/Jakarta';
SET SESSION time_zone = 'Asia/Jakarta';You might get an error "Query 1 ERROR at Line 1: : Unknown or incorrect time zone: 'Asia/Jakarta'".
To check your MySQL already have the timezone data:
SELECT * FROM mysql.time_zone_name;If that query returns empty, you need to load the timezone to that table.
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -p mysqlYou can execute the commands in backward-steps to set the default MySQL timezone.
Notes:
If you’re using DBngin, the mysql_tzinfo_to_sql command might not be available in your $PATH. In that case, you need to use the absolute path to run it.
/Users/Shared/DBngin/mariadb/10.11.6_arm/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
/Users/Shared/DBngin/mysql/8.0.33/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
/Users/Shared/DBngin/mysql/8.2/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysqlReferences: