java.sql.SQLException: Access denied for user '23561'@'localhost' (using passwor

57 阅读1分钟

使用yml配置数据源,出现错误。

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

导入jdbc依赖后仍然报错。

数据源配置出现问题

# 数据源
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/community?serverTimezone=UTC
    name: root
    password: 333

正确的配置

# 数据源
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/community?serverTimezone=UTC
    username: root
    password: 333