SpringBoot 密码正确却报 java.sql.SQLException: Access denied for user 'root'@'localhost' (using passwor...

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT%2B8
    username: root
    password: 000000
    driver-class-name: com.mysql.cj.jdbc.Driver

Spring Boot连接MySQL,数据库账号密码正确却报以下错误

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

解决:将账号密码改成字符串形式

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT%2B8
    username: "root"
    password: "000000"
    driver-class-name: com.mysql.cj.jdbc.Driver

你可能感兴趣的:(SpringBoot 密码正确却报 java.sql.SQLException: Access denied for user 'root'@'localhost' (using passwor...)