Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change mysql timezone from phpMyAdmin

I am trying to change the timezone of my database. I am on shared server and database support guys can not change it for me only. Time zone is currently +1:00 I want it as +05:30. I searched and tried following but nothing worked.

date_default_timezone_set('timezone_name');

Added to my index.php file.

mysql> SET GLOBAL time_zone = 'timezone_name';

It says access restricted.

SET time_zone = timezone_name

Query run now row affected.

My site is hosted on site-ground us server.

like image 793
Piyush Avatar asked Feb 11 '23 03:02

Piyush


1 Answers

Probably you can change the timezone in .htacess without touching your PHP scripts or MySQL query. Open up your .htaccess file, enter the command as below.

SetEnv TZ your_timezone

For example, enter this command if your location in Jakarta

SetEnv ID Asia/Jakarta

Refer to the link below for available timezone:

http://php.net/manual/en/timezones.php

like image 74
mirza.adipradhana Avatar answered Feb 13 '23 18:02

mirza.adipradhana