当前位置:网站首页>[SSM] an error is reported that the user name of the access denied for user 'WYF' @ 'localhost' (using password: yes) data becomes the user name of the computer

[SSM] an error is reported that the user name of the access denied for user 'WYF' @ 'localhost' (using password: yes) data becomes the user name of the computer

2022-06-28 23:22:00 waiting971118

Access denined for user 'WYF'@'localhost' (using password: YES)

Error message

Integrate SSM When , The error message of loading the database is as follows ( Only part of it was intercepted ):

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 The following error message appears :( among WYF It's the user name of the computer )

Access denied for user 'WYF'@'localhost' (using password: YES)

resolvent

First step : First check jdbc.propertites In the configuration file driver,url,user,password The configuration of is correct

driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf8
username=root
password=123456

The second step : see MySQL Medium user jurisdiction ( You can leave it alone , Try step three directly

use mysql
select host, user from user;
update user set host ='%' where user='root';

The third step : The user name is displayed due to an error , So there should be a problem when importing the configuration ,
Check out my spring-dao.xml The configuration file :

 The original configuration 
<context:property-placeholder location="classpath:jdbc.properties"/>
 It is amended as follows :
<context:property-placeholder location="classpath:jdbc.properties" system-properties-mode="NEVER"/>

Problem solving .

原网站

版权声明
本文为[waiting971118]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/179/202206282314493218.html