SpringBoot在配置MySql数据源时,出现了错误,
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
这错误一看就是MySql用户名或密码错误,检查了正确以及是否有空格,
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
first: #数据源1
url: jdbc:mysql://127.0.0.1:3306/visitor?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT
username: root
password: 0000
second: #数据源2
url: jdbc:mysql://127.0.0.1:3306/visitor?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT
username: root