Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
See serverfault.com/questions/446505/… –  BullfrogBlues Feb 23 '13 at 13:47
add comment

2 Answers

client can change its own time zone with this statement:

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

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)
share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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