Spring项目使用mysql8.0时需要注意的两点

一.之前的连接url配置
jdbc:mysql://localhost:3306/steam?unicode=utf8

根据MySQL 5.5.45 +,+,+ 5.6.26 5.7.6要求SSL连接必须建立明确的选项默认情况下如果不设置。符合现有的应用程序不使用SSL的verifyservercertificate属性设置为“false”。你需要显式禁用SSL设置usessl = false,或设置usessl =真实提供服务器证书验证信任库;

修改url为:

jdbc:mysql://localhost:3306/snail?useUnicode=true&characterEncoding=utf-8&useSSL=false

注意要使用 & 符号,否则spring的配置文件会报错;useSSL=false不使用服务器验证;

二.mysql8.0对jdbc驱动版本有要求,使用

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.11</version>
    <scope>runtime</scope>
</dependency>
三.The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone异常
需要修改时区




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章