一开始操作数据库的时候不知道为啥3306端口连接不上,就换成了3307端口,配置信息那里也改了,还是连接不上
把驱动spring.datasource.driver-class-name=com.mysql.jdbc.Driver改成spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver也还是没用
#Thymeleaf 编码
spring.thymeleaf.encoding=UTF-8
#热部署静态文件
spring.thymeleaf.cache=false
#使用HTML5的标准
spring.thymeleaf.mode=HTML5
#使用H2控制台
spring.h2.console.enabled=true
#DataSource
spring.datasource.url=jdbc:mysql://localhost:3307/springbootdemo
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#JPA
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
以解决,在连接数据库的url后加上?serverTimezone=UTC