无法加载时区? [英] Unable to load timezones?
问题描述
我尝试加载时区到我的MySql实例(运行在Unbuntu上),以便我可以使用CONVERT_TZ函数,但当我运行以下命令:
I am attempting to load timezones into my MySql instance (that is running on Unbuntu) so that I can use the CONVERT_TZ function but when I run the command below:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
我得到以下输出,当我尝试使用 CONVERT_TZ
它只是返回 NULL
still:
I get the following output and when I try to use CONVERT_TZ
it just returns NULL
still:
警告:无法加载'/ usr / share / zoneinfo / Asia / Riyadh87'为时间
区域。跳过它。警告:无法加载
'/ usr / share / zoneinfo / Asia / Riyadh88'作为时区。跳过它。
警告:无法加载'/ usr / share / zoneinfo / Asia / Riyadh89'为时间
区域。跳过它。警告:无法加载
'/ usr / share / zoneinfo / Mideast / Riyadh87'作为时区。跳过它。
警告:无法加载'/ usr / share / zoneinfo / Mideast / Riyadh88'为时间
区域。跳过它。警告:无法加载
'/ usr / share / zoneinfo / Mideast / Riyadh89'作为时区。跳过它。
警告:无法加载'/usr/share/zoneinfo/iso3166.tab'为时间
区域。跳过它。警告:无法加载
'/ usr / share / zoneinfo / posix / Asia / Riyadh87'作为时区。跳过它。
警告:无法加载'/ usr / share / zoneinfo / posix / Asia / Riyadh88'为
时区。跳过它。警告:无法加载
'/ usr / share / zoneinfo / posix / Asia / Riyadh89'作为时区。跳过它。
警告:无法加载'/ usr / share / zoneinfo / posix / Mideast / Riyadh87'
作为时区。跳过它。警告:无法加载
'/ usr / share / zoneinfo / posix / Mideast / Riyadh88'作为时区。跳过
。警告:无法加载
'/ usr / share / zoneinfo / posix / Mideast / Riyadh89'作为时区。跳过
。警告:无法加载/ usr / share / zoneinfo / right / Asia / Riyadh87'
作为时区。跳过它。警告:无法加载
'/ usr / share / zoneinfo / right / Asia / Riyadh88'作为时区。跳过它。
警告:无法加载'/ usr / share / zoneinfo / right / Asia / Riyadh89'为
时区。跳过它。警告:无法加载
'/ usr / share / zoneinfo / right / Mideast / Riyadh87'作为时区。跳过
。警告:无法加载
'/ usr / share / zoneinfo / right / Mideast / Riyadh88'作为时区。跳过
。警告:无法加载
'/ usr / share / zoneinfo / right / Mideast / Riyadh89'作为时区。跳过
。警告:无法加载'/usr/share/zoneinfo/zone.tab'为时间
区域。跳过它。
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. Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/posix/Asia/Riyadh87' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/posix/Asia/Riyadh88' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/posix/Asia/Riyadh89' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/posix/Mideast/Riyadh87' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/posix/Mideast/Riyadh88' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/posix/Mideast/Riyadh89' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/right/Asia/Riyadh87' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/right/Asia/Riyadh88' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/right/Asia/Riyadh89' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/right/Mideast/Riyadh87' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/right/Mideast/Riyadh88' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/right/Mideast/Riyadh89' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
有没有人知道为什么会发生这种情况?
Does anyone have an idea why this would be happening?
PS:
我使用以下方法转换数据时间:
I'm using the following method to convert datetimes:
CONVERT_TZ(NOW(),'UTC', 'PCT')
我正在转换不正确,这是NULL结果的原因?
Is it possible that I'm just converting incorrectly and that is the cause of the NULL results?
推荐答案
这是一个错误的时区文件在Debian上使用Riyadh *:
This is a bug with the timezone files for Riyadh* on Debian:
http://错误.mysql.com / bug.php?id = 20545
推荐的解决方法是简单地忽略警告(如果你不需要那些时区当然):
The recommended workaround is to simply ignore the warning (if you don't need those timezone of course):
mysql_tzinfo_to_sql /usr/share/lib/zoneinfo | mysql -uroot --force mysql
使用 force
选项,您将能够使用 CONVERT_TZ
。这是我刚刚做的一个转录:
After importing TZ data with the --force
option, you will be able to use CONVERT_TZ
. Here is a transcription of what I've just done:
sh$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -p mysql --force 2> /dev/null
Enter password: ********
sh$ mysql -p
Enter password: ********
Server version: 5.1.49-3 (Debian)
mysql> select convert_tz(now(), 'UTC', 'CET');
+---------------------------------+
| convert_tz(now(), 'UTC', 'CET') |
+---------------------------------+
| 2013-08-13 21:04:34 |
+---------------------------------+
1 row in set (0.00 sec)
这篇关于无法加载时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!