Error: Error occurred during setting time zone with name
mysql> SET GLOBAL time_zone = 'US/Eastern';
ERROR 1298 (HY000): Unknown or incorrect time zone: 'US/Eastern'
Solution:
- Check the table mysql.time_zone_name.
mysql> SELECT COUNT(*) FROM mysql.time_zone_name;
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 s
2. Download the time zone table:
https://dev.mysql.com/downloads/timezones.html
3. Insert or load the download file into mysql database with following command.
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p mysql < C:\d\timezone_posix.sql
Enter password: *********
C:\Program Files\MySQL\MySQL Server 8.0\bin>
4. Now Test again
mysql> SELECT COUNT(*) FROM mysql.time_zone_name;
+----------+
| COUNT(*) |
+----------+
| 594 |
+----------+
1 row in set (0.01 sec)
mysql> SET GLOBAL time_zone = 'US/Eastern';
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT @@GLOBAL.time_zone, @@SESSION.time_zone;
+--------------------+---------------------+
| @@GLOBAL.time_zone | @@SESSION.time_zone |
+--------------------+---------------------+
| US/Eastern | +00:00 |
+--------------------+---------------------+
1 row in set (0.00 sec)
Pingback: Check Time zone in MySQL | Smart way of Technology