'set timezone mysql

I want to set timezone in mysql from default timezone ('los angles') to my own timezone ('asia/jakart'). I have been change the timezone using query ->

SET GLOBAL TIME_ZONE = 'ASIA/JAKARTA'

The timezone was change if i using the query above. but if i restart mysql, the timezone is back to default timezone(los angels).

How to make the timezone changed permanent to asia/jakarta?



Solution 1:[1]

Put the following in your mysql server configuration (e.g. my.cnf)

default-time-zone=Asia/Jakarta

Please check the doc here

Solution 2:[2]

In /etc/mysql/my.cnf

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
default_time_zone=Asia/Jakarta

Remember to use underscores _

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HungryCoder
Solution 2 Azmat Karim Khan