Вопрос

I am moving a AWS RDS database to an EC2 box. When I try importing the sql file I exported from my RDS server, I get an error that reads

Unknown or incorrect time zone: 'UTC'

I check the @@global.time_zone and @@session.time_zone variables on my EC2 box and they are set to 'system'. The same variables on my RDS server is set to 'UTC'.

I try setting these variables on my EC2 server with the following commands:

SET @@global.time_zone = 'UTC';
SET @@session.time_zone = 'UTC';

I get the same Unknown or incorrect time zone: 'UTC' from running these SET statements. I then run:

SET @@global.time_zone = '+00:00';
SET @@session.time_zone = '+00:00';

which essentially sets the system to UTC. But when I look up the @@global.time_zone and @@session.time_zone variables, they read +00:00 and I get the same error when trying to import my sql file.

How do I set my EC2 MySQL server to UTC time? Is there another way to successfully transfer my DB from my RDS instance to EC2?

Это было полезно?

Решение

The behavior you are reporting makes it sound like the time zone tables are not loaded. (The default installation of MySQL doesn't load these tables.)

Instructions for loading the MySQL time zone tables are here:

1http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html

If those tables aren't loaded, then you won't be able to use named time zones, but time zone values like "+0:00" will work.

To keep the instance time_zone "set" at startup, you'll want to set the default_time_zone variable in the mysqld section of the my.cnf file.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top