JDBC连接错误:无法识别的时区

mce*_*ilg 6 java mysql jdbc

使用JDBC连接到mysql数据库时出现此错误.

Database.getConnection() Error -->The server time zone value 'EEST' 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 specifc time zone value if you want to utilize
time zone support.
Run Code Online (Sandbox Code Playgroud)

那是我的连接代码.

public static Connection getConnection(){
    try {
        Class.forName("com.mysql.jdbc.Driver");

        Connection con = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/management", "root", "root");
        return con;
    } catch (ClassNotFoundException | SQLException e) {
        // TODO Auto-generated catch block
        System.out.println("Database.getConnection() Error -->"
                + e.getMessage());
        return null;
    }

}
Run Code Online (Sandbox Code Playgroud)

Pan*_*031 6

我认为与Mysql和系统的不匹配时区存在问题.因此,最好将值设置为同步.您还可以参考以下链接来设置时间:如何设置MySQL的时区?