com.mysql.cj.jdbc.Driver的使用

可能是因为我用的 mysql-connector-java 的版本太高了,用原来的 com.mysql.jdbc.Driver的话 IDEA 给我报了个错误,要求我使用com.mysql.cj.jdbc.Driver 这个驱动类,这个驱动类 需要指定时区serverTimezone,

url=jdbc:mysql://localhost:3306/test?serverTimezone=Shanghai&?useUnicode=true&characterEncoding=utf8&useSSL=false

如果未明确设置,MySQL 5.5.45+, 5.6.26+ and 5.7.6+版本默认要求建立SSL连接。
为了符合当前不使用SSL连接的应用程序,verifyServerCertificate属性设置为’false’。
如果你不需要使用SSL连接,你需要通过设置useSSL=false来显式禁用SSL连接。
如果你需要用SSL连接,就要为服务器证书验证提供信任库,并设置useSSL=true

猜你喜欢

转载自blog.csdn.net/zhousw1999/article/details/83785505