springboot中ymal配置mysql数据库的坑
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
username: "用户名"
password: "密码"
注意:用户名和密码要带双引号
还有如果出现以下错误
Access denied for user 'root'@'localhost' (using password: YES)
不用想太多,就是密码错误或者没加引号
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
如果出现这个错误,试试更改自己导入的mysql的版本是否不一致