java 连接mysql 5.7

xiaoxiao2021-02-28  92

driver=com.mysql.cj.jdbc.Driver user=root password=ironman2014 url=jdbc:mysql://localhost/mydb?characterEncoding=utf8&useSSL=true&serverTimezone=UTC

需要在jdbc:mysql://localhost/mydb后面加上characterEncoding=utf8&useSSL=true&serverTimezone=UTC。同时driver 变成com.mysql.cj.jdbc.Driver。

以下两个错误的产生都是由于url问题

1.没有加useSSL=ture

Establishing SSL connection without server's identity verification is not recommended.

2.没加serverTimezone

The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone.
转载请注明原文地址: https://www.6miu.com/read-62551.html

最新回复(0)