导入别人的项目,出现一个错误,经过排查,是db.properties配置文件中的用户名与Mybatis-conf.xml配置文件中调用的用户名不一致所导致的

(db.properties中用的是name,而调用时用的确实username ,即${username}),只要把配置文件中的name改为username即可。

截图如下:

org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)
### Cause: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:)
at dbBookTest.StudentCERUDTest.add(StudentCERUDTest.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.junit.runners.model.FrameworkMethod$.runReflectiveCall(FrameworkMethod.java:)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:)
at org.junit.runners.ParentRunner$.run(ParentRunner.java:)
at org.junit.runners.ParentRunner$.schedule(ParentRunner.java:)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:)
at org.junit.runners.ParentRunner.access$(ParentRunner.java:)
at org.junit.runners.ParentRunner$.evaluate(ParentRunner.java:)
at org.junit.runners.ParentRunner.run(ParentRunner.java:)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:)
Caused by: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:)
at java.lang.reflect.Constructor.newInstance(Constructor.java:)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:)
at java.sql.DriverManager.getConnection(DriverManager.java:)
at java.sql.DriverManager.getConnection(DriverManager.java:)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:)
at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:)
at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:)
... more

Error updating database. Cause: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)的更多相关文章

  1. java.sql.SQLException: Access denied for user 'sa'@'localhost' (using password: YES)

    1.错误描述 ERROR:2015-05-01 23:43:04[localhost-startStop-1] - HHH000319: Could not get database metadata ...

  2. java.sql.SQLException: Access denied for user 'sa'@'localhost' (using password: NO)

    1.错误描述 INFO:2015-05-01 16:53:29[main] - HHH000228: Running hbm2ddl schema update INFO:2015-05-01 16: ...

  3. [Spring MVC - 2A] - java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

    严重: Servlet.service() for servlet [springMVC] in context with path [/ExceptionManageSystem] threw ex ...

  4. java.sql.SQLException: Access denied for user 'Administrator'@'localhost' (using password: YES)

    早上在做MyBatis+Spring整合的时候爆了个奇葩的bug: 十月 19, 2017 11:18:11 上午 org.springframework.context.support.Abstra ...

  5. 技术笔记1:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password)

    在myEclipse10中运行java项目的时候,遇到java.sql.SQLException: Access denied for user 'root'@'localhost' (using p ...

  6. java.sql.SQLException: Access denied for user 'roo'@'localhost' (using password: YES)

    初学mysql,安装了mysql8.0.11,激动的用jdbc连接数据库,出现error,折腾了三天依旧无解,最后无奈装了比较稳定的mysql5.5,问题得以解决,很迷,但只要error没了就开心. ...

  7. java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)

    在更新项目之后,做了一定的改动后发现竟然报错了,刚才还好好的. java.sql.SQLException: Access denied for user 'root'@'localhost' (us ...

  8. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using password: YES)

    今天用eclipse连接一下数据库,出现此异常. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using pa ...

  9. java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 解决办法

    一.背景 在Spark中,将DStream写入到MySQL出现错误:java.sql.SQLException: Access denied for user 'root'@'localhost' ( ...

随机推荐

  1. Xhprof分析php性能

    https://windows.php.net/downloads/pecl/releases/xhprof/0.10.6/ 下载Xhprof版本 配置一个本地访问url,指向index.php,能访 ...

  2. O(n*logn)级别的算法之二(快速排序)的三种实现方法详解及其与归并排序的对比

    一,单路快排1.测试用例: #ifndef INC_06_QUICK_SORT_DEAL_WITH_NEARLY_ORDERED_ARRAY_SORTTESTHELPER_H #define INC_ ...

  3. Asp.NetMVC利用LigerUI搭建一个简单的后台管理详解(函登录验证)

    上一篇 Asp.Net 中Grid详解两种方法使用LigerUI加载数据库数据填充数据分页  了解了LigerUI 中Grid的基本用法  现在结合上一篇的内容做一个简单的后台管理,当然也有前台的页面 ...

  4. Dynamics 365检查工作流、SDK插件步骤是否选中运行成功后自动删除系统作业记录

    本人微信公众号:微软动态CRM专家罗勇 ,回复298或者20190120可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 系统 ...

  5. Xamarin 学习笔记 - Page(页面)

    本文翻译自CodeProject文章:https://www.codeproject.com/Articles/1226447/Xamarin-Notes-Xamarin-Forms-Pages 转载 ...

  6. Java内存管理的进一步理解-模拟过程图解

    Java内存管理的进一步理解-模拟过程图解--转载 java的内存管理分为: 1.堆内存:2.栈内存:3.方法区:4.本地方法区 /* 1:方法区      方法区存放装载的类数据信息包括:      ...

  7. Linux中VSFTP的配置

    配置VSFTP服务器: 1.安装VSFTP,可以参考Linux 中yum的配置来安装: yum installvsftpd.x86_64 -y 2.修改SELinux: setenforce 0 查看 ...

  8. Can't create/write to file '/tmp/MLjnvU95' (Errcode: 13 - Permission denied)

    今天一个同事反馈往一个MySQL数据库导入数据时,报"ERROR 1 (HY000): Can't create/write to file '/tmp/MLjnvU95' (Errcode ...

  9. local_irq_disable和disable_irq的区别

    local_irq_disable: local_irq_disable的功能是屏蔽当前CPU上的所有中断,通过操作arm核心中的寄存器来屏蔽到达CPU上的中断,此时中断控制器中所有送往该CPU上的中 ...

  10. c/c++ 网络编程 使用getaddrinfo的单纯UDP 通信

    网络编程 使用getaddrinfo的单纯UDP 1,UDP发送端 2,UDP接收端 UDP发送端: #include <stdio.h> #include <unistd.h> ...