我有一个convert_tz在mysql中返回null的问题。
mysql --version
mysql Ver 14.14 Distrib 5.6.11, for osx10.7 (x86_64) using EditLine wrapper
我阅读了手册http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html 我运行了这个命令:bash-3.2# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql 输入密码:警告:无法加载“/usr/share/zoneinfo/+VERSION”作为时区。跳过它。
Warning: Unable to load '/usr/share/zoneinfo/Asia/Riyadh87' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/Asia/Riyadh88' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/Asia/Riyadh89' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/Mideast/Riyadh87' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/Mideast/Riyadh88' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/Mideast/Riyadh89' as time zone. Skipping it.
ERROR 1406 (22001) at line 38916: Data too long for column 'Abbreviation' at row 1
然后,使用 mysql 我运行了这个命令。SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','EST'); 返回null。我可以确认 mysql.time_zone_transition_type 表有 GMT 和 EST 条目。