当前位置:网站首页>【SSM】报错 Access denied for user ‘WYF‘@‘localhost‘ (using password: YES) 数据的用户名变成了电脑的用户名
【SSM】报错 Access denied for user ‘WYF‘@‘localhost‘ (using password: YES) 数据的用户名变成了电脑的用户名
2022-06-28 23:16:00 【waiting971118】
报错信息
整合SSM的时候,加载数据库报错信息如下(仅截取了一部分):
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82)
at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:271)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:69)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:56)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
... 41 more
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 51 more
Debug之后出现了以下报错信息:(其中WYF是电脑的用户名)
Access denied for user 'WYF'@'localhost' (using password: YES)
解决方法
第一步:先检查jdbc.propertites配置文件中的driver,url,user,password的配置无误
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf8
username=root
password=123456
第二步:查看MySQL中的user权限(可以先不进行,直接进行第三步试试)
use mysql
select host, user from user;
update user set host ='%' where user='root';
第三步:由于报错显示了用户名,所以应该是导入配置的时候出了问题,
查看我的spring-dao.xml配置文件:
原本的配置
<context:property-placeholder location="classpath:jdbc.properties"/>
修改为:
<context:property-placeholder location="classpath:jdbc.properties" system-properties-mode="NEVER"/>
问题解决。
边栏推荐
- Go language - reflect
- Lost in cloud computing
- 复杂嵌套的对象池(4)——管理多类实例和多阶段实例的对象池
- Undefined symbol main (referred from entry9a.o).
- 生产环境sonarqube安装
- Complex nested object pool (4) -- manage the object pool of multi class instances and multi-stage instances
- Mathematical knowledge: finding combinatorial number I - finding combinatorial number
- 在QT进行cin(全网最清晰教程)
- Langage C - analyse des mots
- C# 面试题目_20220627记录一下
猜你喜欢

Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal

Chapter V virtual memory exercise

【深度学习】(3) Transformer 中的 Encoder 机制,附Pytorch完整代码
![[数学建模]Matlab非线性规划之fmincon()函数](/img/fc/46949679859b1369fcc83d0d8b637c.png)
[数学建模]Matlab非线性规划之fmincon()函数

Web API learning notes 1
![[stm32 HAL库] 串口通信](/img/2c/23a2ecf75141b8f38ab99ac6b2eaef.png)
[stm32 HAL库] 串口通信
![[matlab]函数定义与使用](/img/43/a7970ca8e075151277f7773434f7db.png)
[matlab]函数定义与使用

LeCun预言AGI:大模型和强化学习都是斜道!我的世界模型才是新路

keil工程,程序写多后,RTT不能打印

At the end of June, how many people in Kangkang are ready to change jobs
随机推荐
TDD and automated testing
Production environment sonarqube installation
自媒体行业内卷严重:企业自媒体应该何去何从
数学知识:求组合数 I—求组合数
见丰知夏|国漫鼻祖丰子恺,数字藏品独家发售
在长投学堂开通证券账户是安全可靠的吗?
Finally, someone explained the cloud native architecture
[word Tutorial Series Part 1] how to remove arrows in word tables
[stm32 Hal library] RTC and BKP drives
WMS仓库管理系统模块之波次拣货
SqlServer复习
[matlab]函数定义与使用
CS5463代码模块解析(包含下载链接)
第五章 虚拟存储器 练习
leetCode-栈类型详解
[deep learning] (3) encoder mechanism in transformer, complete pytoch code attached
Wave picking of WMS warehouse management system module
Mono's execution process
【剑指Offer】50. 第一个只出现一次的字符
TDD case practice