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

1

2 Answers 2

1

client can change its own time zone with this statement:

SET time_zone = '+0:00';
1
  • is there any way I can change runtime using query?
    – Avinash
    Feb 22, 2011 at 9:06
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)
4
  • is there any way I can change runtime using query?
    – Avinash
    Feb 22, 2011 at 9:06
  • @Avinash: See my edit
    – user9517
    Feb 22, 2011 at 9:18
  • @lain "SET GLOBAL" need super privilege
    – bindbn
    Feb 22, 2011 at 9:29
  • @bindbn: which the root account would likely have ?
    – user9517
    Feb 22, 2011 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .