2

I want to change mysql default timezone to UK timezone,

I have no access to mysql config file. Is there any way that I can do this on query level.

So once the query executed then it will save date based on Uk timezone,

Thanks

Avinash
  • 181
  • 1
  • 2
  • 9

2 Answers2

1

client can change its own time zone with this statement:

SET time_zone = '+0:00';
ooshro
  • 10,874
  • 1
  • 31
  • 31
0

In the configuration file you are loading you can set the timezone with the default-time-zone='timezone' directive e.g.

default-time-zone='+00:00'

for UTC. There is more information in the MySQL timezone reference manual

Edit:

To change your timezone on the fly use the SET GLOBAL time_zone = 'timezone' ; command e.g.

mysql -u root -p
your password

mysql> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| SYSTEM             |
+--------------------+
1 row in set (0.00 sec)

mysql> SET GLOBAL time_zone = '+00:00';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@global.time_zone;
+--------------------+
| @@global.time_zone |
+--------------------+
| +00:00             |
+--------------------+
1 row in set (0.00 sec)
user9517
  • 114,104
  • 20
  • 206
  • 289