Springboot连接mysql报错java.sql.SQLException:Access denied for user ‘ ‘@‘XXX.XXX.XXX.XXX‘的处理
程序员文章站
2022-06-02 18:34:07
...
1.遇到这个问题之前,网上搜的都是登录账号错误的问题,但是我用数据库连接工具都可以连接啊,然后仔细看这个错误,发现了问题。
对比一下:
java.sql.SQLException:Access denied for user ''@'XXX.XXX.XXX.XXX'
java.sql.SQLException:Access denied for user 'root'@'XXX.XXX.XXX.XXX'
是不是看出来了,上面那个登录失败,就是登录mysql的时候,自己的账号压根没输入进去,再仔细看看自己配置。
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/myself
driver-class-name: com.mysql.cj.jdbc.Driver
name: root
password: 123456
如果你的配置跟我一样,那就错了,mysql的账号的全路径是spring.datasource.username,而不是spring.datasource.name和spring.datasource.data-username什么的,千万别写错了。
上一篇: ci框架连接数据遇到有关问题
推荐阅读
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
Springboot连接mysql报错java.sql.SQLException:Access denied for user ‘ ‘@‘XXX.XXX.XXX.XXX‘的处理
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决