錯誤:
The server time zone value ‘йʱ’ 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.
原因:時區錯誤(jdbc 6.0以上都有這個問題)
修改:在url的字符串中添加 servertime=UTC
String url="jdbc:mysql://localhost:3306/school?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=UTC";
- useUnicode=true 表示使用Unicode字符,因此可以使用中文
- characterEncoding=utf8 設置編碼方式
- useSSL=true 設置安全連接
- serverTimezone=UTC 設置全球標準時間