博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql_tzinfo_to_sql (Unknown or incorrect time zone: ‘UTC‘ )
阅读量:2155 次
发布时间:2019-05-01

本文共 3643 字,大约阅读时间需要 12 分钟。

本篇文章也是解决Unknown or incorrect time zone: 'UTC'  等其他timezone问题

mysql_tzinfo_to_sql — Load the Time Zone Tables 4.4.6

The mysql_tzinfo_to_sql program loads the time zone tables in the mysql database. It is used on systems that have a zoneinfo database (the set of files describing time zones). Examples of such systems are Linux, FreeBSD, Solaris, and macOS. One likely location for these files is the /usr/share/zoneinfo directory (/usr/share/lib/zoneinfo on Solaris). If your system does not have a zoneinfo database, you can use the downloadable package described in Section 5.1.13, “MySQL Server Time Zone Support”.

mysql_tzinfo_to_sql程序将时区表加载到mysql数据库中。 它在具有zoneinfo数据库(描述时区的文件集)的系统上使用。 此类系统的示例是Linux,FreeBSD,Solaris和macOS。 这些文件的一个可能位置是/usr/share/zoneinfo目录(在Solaris上为/ usr / share / lib / zoneinfo)。 如果您的系统没有zoneinfo数据库,则可以使用第5.1.13节“ MySQL服务器时区支持”中所述的可下载软件包。

mysql_tzinfo_to_sql can be invoked several ways:

shell> mysql_tzinfo_to_sql tz_dirshell> mysql_tzinfo_to_sql tz_file tz_nameshell> mysql_tzinfo_to_sql --leap tz_file

第一种 

For the first invocation syntax, pass the zoneinfo directory path name to mysql_tzinfo_to_sql and send the output into the mysql program. For example:

对于第一种调用语法,请将zoneinfo目录路径名传递给mysql_tzinfo_to_sql并将输出发送到mysql程序。 例如:

# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p密码 mysqlshell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

第二种  

mysql_tzinfo_to_sql reads your system's time zone files and generates SQL statements from them. mysql processes those statements to load the time zone tables.

The second syntax causes mysql_tzinfo_to_sql to load a single time zone file tz_file that corresponds to a time zone name tz_name:

mysql_tzinfo_to_sql读取系统的时区文件并从中生成SQL语句。 mysql处理这些语句以加载时区表。

第二种语法使mysql_tzinfo_to_sql加载与时区名称tz_name对应的单个时区文件tz_file:

shell> mysql_tzinfo_to_sql tz_file tz_name | mysql -u root mysql

第三种 

If your time zone needs to account for leap seconds, invoke mysql_tzinfo_to_sql using the third syntax, which initializes the leap second information. tz_file is the name of your time zone file。

如果您的时区需要计算leap秒,请使用第三种语法调用mysql_tzinfo_to_sql,这将初始化leap second信息。 tz_file是您的时区文件的名称

mysql_tzinfo_to_sql --leap tz_file | mysql -u root mysql

After running mysql_tzinfo_to_sql, it is best to restart the server so that it does not continue to use any previously cached time zone data.

运行mysql_tzinfo_to_sql后,最好重新启动服务器,以使其不再继续使用任何以前缓存的时区数据。

 

没有mysql_tzinfo_to_sql

If your system has no zoneinfo database (for example, Windows), you can use a package containing SQL statements that is available for download at the MySQL Developer Zone

如果您的系统没有zoneinfo数据库(例如Windows),则可以使用包含SQL语句的软件包,该软件包可从MySQL开发人员专区下载:

https://dev.mysql.com/downloads/timezones.html

Warning

Do not use a downloadable time zone package if your system has a zoneinfo database. Use the mysql_tzinfo_to_sql utility instead. Otherwise, you may cause a difference in datetime handling between MySQL and other applications on your system.

警告

如果您的系统具有zoneinfo数据库,请不要使用可下载的时区软件包。 请改用mysql_tzinfo_to_sql实用程序。 否则,可能会导致MySQL与系统上其他应用程序之间在日期时间处理上有所不同。

To use an SQL-statement time zone package that you have downloaded, unpack it, then load the unpacked file contents into the time zone tables:

要使用已下载的SQL语句时区包,请对其进行解压缩,然后将解压缩的文件内容加载到时区表中:

mysql -u root -p mysql < file_name

Then restart the server.

 Warning

Do not use a downloadable time zone package that contains MyISAM tables. That is intended for older MySQL versions. MySQL 5.7 and higher uses InnoDB for the time zone tables. Trying to replace them with MyISAM tables causes problems.

警告

不要使用包含MyISAM表的可下载的时区包。 这适用于较旧的MySQL版本。 MySQL 5.7及更高版本将InnoDB用于时区表。 尝试用MyISAM表替换它们会导致问题。

转载地址:http://vhxwb.baihongyu.com/

你可能感兴趣的文章
Leetcode C++ 《拓扑排序-1》20200626 207.课程表
查看>>
Go语言学习Part1:包、变量和函数
查看>>
Go语言学习Part2:流程控制语句:for、if、else、switch 和 defer
查看>>
Go语言学习Part3:struct、slice和映射
查看>>
Go语言学习Part4-1:方法和接口
查看>>
Leetcode Go 《精选TOP面试题》20200628 69.x的平方根
查看>>
leetcode 130. Surrounded Regions
查看>>
【托业】【全真题库】TEST2-语法题
查看>>
博客文格式优化
查看>>
【托业】【新托业全真模拟】疑难语法题知识点总结(01~05)
查看>>
【SQL】group by 和order by 的区别。
查看>>
【Python】详解Python多线程Selenium跨浏览器测试
查看>>
Jmeter之参数化
查看>>
Shell 和Python的区别。
查看>>
Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结
查看>>
Loadrunner之https协议录制回放报错如何解决?(九)
查看>>
python中xrange和range的异同
查看>>
列表、元组、集合、字典
查看>>
【Python】easygui小甲鱼
查看>>
【Python】关于Python多线程的一篇文章转载
查看>>