mysql驅動更新迭代之后驅動,稍微有點變化:
com.mysql.jdbc.Driver (變化為) --> driver-class-name: com.mysql.cj.jdbc.Driver
還有就是另一個報錯
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
這個是由於時區的問題,之前在SSM中 這樣寫是沒有問題的,
jdbc:mysql://127.0.0.1:3306/jtdb?useUnicode=true&characterEncoding=UTF-8
但是換spring boot之后,可能是自動匹配新版本的原因吧,導致的,更換為
jdbc:mysql://127.0.0.1:3306/jtdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
沒有問題了,
完整的yml配置數據庫的配置
spring:
datasource:
# driver-class-name: com.mysql.jdbc.Driver com.mysql.cj.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://127.0.0.1:3306/jtdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
做個備忘,防止以后出現類似的問題,節省時間
