使用yml配置文件配置数据库连接信息时,如果数据库密码为纯数字,需要加双引号(""),否则会报Access denied for user ‘root’@'localhost’错误。
spring:
datasource:
url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=GMT
username: root
password: "123456"
driver-class-name: com.mysql.cj.jdbc.Driver