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

link|improve this question

29% accept rate
feedback

2 Answers

client can change its own time zone with this statement:

SET time_zone = '+0:00';
link|improve this answer
is there any way I can change runtime using query? – Avinash Feb 22 '11 at 9:06
feedback

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)
link|improve this answer
is there any way I can change runtime using query? – Avinash Feb 22 '11 at 9:06
@Avinash: See my edit – Iain Feb 22 '11 at 9:18
@lain "SET GLOBAL" need super privilege – bindbn Feb 22 '11 at 9:29
@bindbn: which the root account would likely have ? – Iain Feb 22 '11 at 9:33
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.