Bug #45383 TZ (timezone) environment variable ignored.
Submitted: 8 Jun 2009 23:04 Modified: 28 Jul 2010 14:52
Reporter: Alain Knaff Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:Ver 14.12 Distrib 5.0.75 OS:Linux
Assigned to: CPU Architecture:Any
Tags: timezone environment

[8 Jun 2009 23:04] Alain Knaff
Description:
The mysql client ignores the TZ environment variable (timezone), which is honored by most other time-aware Unix programs (such as date).

Instead timezone has to be set using the set time_zone='timezone'; command. This command does not understand standard timezone names such as MET, GMT, ...

This makes it necessary to handle mysql in a special way in a script, rather than to allow setting a single variable.

How to repeat:
export TZ=UTC
mysql
select now();

set time_zone='UTC';

Suggested fix:
If TZ set, automatically do set time_zone='$TZ';
Make set time_zone understand the standard time_zone names.
[9 Jun 2009 6:05] Sveta Smirnova
Thank you for the report.

Verified as feature request, although personally me think introducing such a feature by default can break existing environments. Probably some client option like --use-TZ should be introduced.

Regarding to named timezones please read http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html
[28 Jul 2010 14:52] Alain Knaff
Why should the user need to add an extra option just to get standard behavior? 

Couldn't that be made the default behavior, and only disable timezone handling if --ignore-TZ is given?

And what kind of environments would be broken by the fix?

Well, as long as you can put this new option in the /etc/mysql/my.cnf file, it is a livable compromise...