- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
mysql_tzinfo_to_sql - Load the Time Zone Tables in MySQL
152 Lectures 16 hours
87 Lectures 5.5 hours
The mysql_tzinfo_to_sql program helps load the time zone tables in the mysql database. It is used on systems which have a zoneinfo database, i.e the set of files that describe the time zones. Examples of such systems include Linux, FreeBSD, Solaris, and macOS. One most probable location for these files is the /usr/share/zoneinfo directory (/usr/share/lib/zoneinfo on Solaris).
If the system doesn’t have a zoneinfo database, the downloadable package can be installed. The mysql_tzinfo_to_sql can be invoked in many ways. Some of them have been shown below −
shell> mysql_tzinfo_to_sql tz_dir (or) shell> mysql_tzinfo_to_sql tz_file tz_name (or) shell> mysql_tzinfo_to_sql --leap tz_file
In the first invocation syntax, the zoneinfo directory path name is passed to the mysql_tzinfo_to_sql. The output is sent to the mysql program.
Let us take an example to understand this −
shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
mysql_tzinfo_to_sql reads the user’s system's time zone files and generates SQL statements from them. Then, mysql processes these statements so as to load into the time zone tables.
The second invokation causes mysql_tzinfo_to_sql to load a single time zone file tz_file which corresponds to a time zone name tz_name as shown below −
shell> mysql_tzinfo_to_sql tz_file tz_name | mysql -u root mysql
If the user’s time zone needs to account for leap seconds, mysql_tzinfo_to_sql can be invoked with the help of the third syntax. This third syntax initializes the leap second information. The tz_file is the name of your time zone file −
shell> mysql_tzinfo_to_sql --leap tz_file | mysql -u root mysql
After running mysql_tzinfo_to_sql, it is suggested to restart the server so that it doesn’t continue to use previously cached time zone data.
- How do I get the current time zone of MySQL?
- Get the default Time Zone in Java
- Java Program to display Current Time in another Time Zone
- Set the base time zone offset to GMT in Java
- How to use time zone in a JSP?
- How to set time zone in a JSP?
- MySQL Extensions to Standard SQL
- Get all the IDs of the Time Zone in Java
- MySQL join two tables?
- Python Pandas - Convert Timestamp to another time zone
- Get the IDs according to the given time zone offset in Java
- How to run SQL script in MySQL?
- How to lock multiple tables in MySQL?
- How to return the time-zone offset in minutes for the current locale?
- Python Pandas - Convert naive Timestamp to local time zone