The mysql_tzinfo_to_sql program loads the time zone tables in the mysql
database. mysql_tzinfo_to_sql
程序加载mysql数据库中的时区表。It is used on systems that have a zoneinfo database (the set of files describing time zones). 它用于具有zoneinfo数据库(描述时区的文件集)的系统。Examples of such systems are Linux, FreeBSD, Solaris, and macOS. One likely location for these files is the 此类系统的示例包括Linux、FreeBSD、Solaris和macOS。这些文件的一个可能位置是/usr/share/zoneinfo
directory (/usr/share/lib/zoneinfo
on Solaris). /usr/share/zoneinfo
目录(Solaris上的/usr/share/lib/zoneinfo
)。If your system does not have a zoneinfo database, you can use the downloadable package described in Section 5.1.15, “MySQL Server Time Zone Support”.如果您的系统没有zoneinfo数据库,您可以使用第5.1.15节,“MySQL服务器时区支持”中描述的可下载包。
mysql_tzinfo_to_sql can be invoked several ways:mysql_tzinfo_to_sql可以通过多种方式调用:
mysql_tzinfo_to_sqltz_dir
mysql_tzinfo_to_sqltz_file tz_name
mysql_tzinfo_to_sql --leaptz_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 mysql
mysql_tzinfo_to_sql reads your system's time zone files and generates SQL statements from them. mysql_tzinfo_to_sql读取系统的时区文件并从中生成sql语句。mysql processes those statements to load the time zone tables.mysql处理这些语句以加载时区表。
The second syntax causes mysql_tzinfo_to_sql to load a single time zone file 第二种语法使mysql_tzinfo_to_sql加载一个与时区名称tz_file
that corresponds to a time zone name tz_name
:tz_name
对应的时区文件tz_file
:
mysql_tzinfo_to_sqltz_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. 如果您的时区需要考虑闰秒,请使用第三种语法调用mysql_tzinfo_to_sql,该语法初始化闰秒信息。tz_file
is the name of your time zone file: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后,最好重新启动服务器,这样它就不会继续使用任何以前缓存的时区数据。