我要评分
获取效率
正确性
完整性
易理解

Time Zone Problem Occurs When Data Is Imported to MySQL

Symptom

The following time zone problem occurs when data is imported to the MySQL database:

1
ERROR: The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to       use a more specific time zone value if you want to utilize time zone support.

Key Process and Cause Analysis

The MySQL server cannot identify the default time zone EDT of the JDBC driver. In this case, set the time zone of the JDBC driver to UTC or the time zone of the MySQL server.

Conclusion and Solution

The following describes how to set the time zone of the JDBC driver to UTC.

  1. Open the my_mysql.properties file.
    1
    vi my_mysql.properties
    
  2. Press i to enter the insert mode and add the following configuration to jdbc:
    1
    serverTimezone=UTC
    

    See the following figure for the added content:

  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Run the data loading command again.
    1
    ./runDatabaseBuild.sh my_mysql.properties