Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I wanted to know if MySQL let the admin set a timezone per database ?

I have three different databases for three different customers. Each of them being in their own timezone.

I would like to load the exact same event for each customer and would like it to run everyday at 00:00:01 for their respective timezone. Is it possible ?

I can load three different sql script specifying in each their respective timezone, but it doesn't scale well and it make me have three version of almost the same file.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

No...

MySQL time zone support includes only a global default time zone and a per-connection time zone. Since any given connection can dynamically USE (as default) any database for which it has privileges, or no database at all, and tables within a single query can cross databases, the concept of a per-database timezone wouldn't be particularly meaningful, much less unambiguous.

...but...

However, if your setup script sets the time zone in its session before defining the scheduled event, that time zone will be used by the scheduler to transform the time you requested the scheduled event into UTC.

Times in the ON SCHEDULE clause are interpreted using the current session time_zone value. This becomes the event time zone; that is, the time zone that is used for event scheduling and is in effect within the event as it executes. These times are converted to UTC and stored along with the event time zone in the mysql.event table. This enables event execution to proceed as defined regardless of any subsequent changes to the server time zone or daylight saving time effects.

http://dev.mysql.com/doc/refman/5.6/en/create-event.html

share|improve this answer
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.