当前位置:网站首页>MySQL密码正确但是启动报错Unable to create initial connections of pool.Access denied for user ‘root‘@‘localhost
MySQL密码正确但是启动报错Unable to create initial connections of pool.Access denied for user ‘root‘@‘localhost
2022-07-22 08:53:00 【scluis】
问题
最近导入了一个SpringBoot项目,在本地配置好之后,项目启动一直报错:
2020-12-17 15:46:42.136 ERROR 19320 --- [restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
最开始以为是数据库密码不对,但是检查了几遍之后发现密码是没有问题的,网上有两种办法:
1.配置数据库时username和password多写了data
错误的:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/hah
spring.datasource.data-username=root
spring.datasource.data-password=123456
修改之后的:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/hah
spring.datasource.username=root
spring.datasource.password=123456
2.Yml配置文件中配置数据库的密码时要加双引号
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=utf-8
username: root
password: "123456"
但是,这两种方法都没有解决我的问题
解决办法
1.打开安装mysql数据库的位置,在my.ini配置文件的最后加上
skip-grant-tables
2.重启MySQL服务
而造成这种错误的原因是代码运行过程中执行sql语句出错从而失去了登陆权限
边栏推荐
- Research on vulnerability identification technology for project version differences
- 【How To 系列】好友裂变平台搭建
- 43. 字符串相乘
- 并发模型值Actor和CSP
- "Review of software engineering in Wuhan University of technology" Chapter III software requirements
- 可重入函数
- Copy of file descriptor
- DistSQL 深度解析:打造动态化的分布式数据库
- pushgateway安装及Prometheus配置
- 按结构体某一元素排序的小程序(fishing_3)
猜你喜欢
「武汉理工大学 软件工程复习」第一章 | 软件工程概述
QT笔记——QJson
Qt|编辑框的使用总结
C语言中continue的理解(fishing_1)
【Rust】为什么我建议你学一下 Rust | Rust 初探
"Review of software engineering in Wuhan University of technology" Chapter III software requirements
How to solve the gloomy life under the middle-aged crisis of it
"Review of software engineering in Wuhan University of technology" Chapter 1 | overview of software engineering
互斥锁和信号量
QT笔记——实现窗体自适应
随机推荐
Computer Graphics From Scratch - Chapter 4
Maintenance of gbase8s database constraint mode
Thread learning notes
qt5.12 + vs2019 无法定位程序输入点 于动态链接库
Go FMT package details
反射+注解+泛型
"Review of software engineering in Wuhan University of technology" Chapter 5 | software architecture
QT笔记——QtXml
Understanding of continue in C language (fishing_1)
shell脚本使用expect自动化交互登录远程主机进行批量关机
Qt Notes - nombre de lignes traînées et de mouvements pour le Widget qtablewidget
「武汉理工大学 软件工程复习」第二章 | 软件过程模型
A trick to teach you how to visualize recruitment data ~ is there anyone who can't analyze these data cases?
一线互联网P7面试题总结---补充中
「武汉理工大学 软件工程复习」第六章 | 编码规范
Multi type low rate DDoS attack detection method based on hybrid deep learning
vcs与verdi学习记录
QT exe只允许运行单个
go 并发编程之-工作池
Installation and introduction of Lin UI component library of wechat applet - Advanced