Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ErrorsSetting up timezone tables in MySql

Tags:

timezone

mysql

I tried to set the timezone tables in the MySql database locally and I'm not being able to do it.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysqldb

The output of the command was the following ones:

Enter password: Warning: Unable to load '/usr/share/zoneinfo/+VERSION' as time zone. Skipping it.

ERROR 1146 (42S02) at line 1: Table 'mysqldb.time_zone' doesn't exist
user:folser user$ 

Do you know what may be happening?

like image 654
felipeclopes Avatar asked Jun 18 '13 17:06

felipeclopes


People also ask

How do I set the time zone in MySQL?

To explicitly specify the system time zone for MySQL Server at startup, set the TZ environment variable before you start mysqld. If you start the server using mysqld_safe, its --timezone option provides another way to set the system time zone. The permissible values for TZ and --timezone are system dependent.

What timezone does MySQL use?

By default, the time zone for a MySQL DB instance is Universal Time Coordinated (UTC). You can set the time zone for your DB instance to the local time zone for your application instead.

How do I set timezone in MySQL 8?

You can set the time zone for the server with the --timezone= timezone_name option to mysqld_safe. You can also set it by setting the TZ environment variable before you start mysqld. The permissible values for --timezone or TZ are system dependent.


1 Answers

The name of the database containing the time zone tables is mysql, not mysqldb.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
like image 189
Barmar Avatar answered Oct 05 '22 20:10

Barmar