org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:
Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Access denied for user 'root '@'localhost' (using password: YES))
### The error may exist in com/sample/mappers/EmployeeMapper.xml
### The error may involve com.sample.dao.EmployeeDao.listall
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:
Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (Access denied for user 'root '@'localhost' (using password: YES))

notice: the user is 'root ' not 'root'

这个问题大致就是需要检查你的数据源配置即Resource中的:url,username,password

url这个一般是"jdbc:mysql://localhost:3306/test",一定要注意3306,这个是你数据库连接用的端口,可以把它改成别的,但是如果你用的tomcat容器,别把它写成8080,这样就会产生Cannot create PoolableConnectionFactory (Communications link failure问题,还有就是url=jdbc:mysql://localhost:3306/test中的localhost,也不是随便配置的,要看你的数据库中的from host

我当时实在MySql Workbench5.2 CE中的 Users and Privileges中,有个Server Access Management

User  From Host 你看From Host中有没有localhost,如果有你就能写成url=jdbc:mysql://localhost:3306/test,要是from host有127.0.0.1的话,也可以写成url=jdbc:mysql://127.0.0.1:3306/test

还有就是 username=  这个一定要写正确,我当时写的是name= ,结果mysql找不到username,然后他自动把username设为"",以至于错误提示: java.sql.SQLException: Access denied for user ‘’ @'localhost' (using password: YES) 你看到@前面是两个单引号了吗,那就是我没输入username而导致默认的默认username,其实这个错误也可以用设置权限改,但是那是mysql内容,就不说了。

总结起来就是:url端口要写对,不能写其他程序被占用的,127.0.01还是localhost要看数据库里面有哪个,还要就是把对的驱动放入项目中的WEB-INF/lib里,这里提一下不用再放到tomcat的lib中。

mybatis connection error Cannot create PoolableConnectionFactory (Access denied for user 'root '@'local的更多相关文章

  1. org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password:

    tationProcessor' to allow for resolving potential circular referencesDEBUG 2018-05-28 11:32:35,016 o ...

  2. 【Error】 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    mysql 登录输入密码有时会碰到如题的错误. 错误描述: Error 1045 (28000): Access denied for user 'root'@'localhost' (using p ...

  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. (Access denied for user 'root'@'slaver1' (using password: YES))

    1.问题描述,启动azkaban的时候报如下所示的错误.之前使用azkaban是root用户,今天使用hadoop用户进行配置和使用,报这个错,说是root连接mysql拒绝了. [hadoop@sl ...

  5. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  6. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因

    在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...

  7. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) ERROR 2013 (HY00 ...

  8. ERROR 1045 (28000): Access denied for user root@localhost (using password:

    错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL ...

  9. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO

    MySQL安装完server端和客户端后,登录Mysql时报错:[root@rhel204 MySQL 5.6.23-RMP]# mysqlERROR 2002 (HY000): Can't conn ...

随机推荐

  1. java 开发常用的Linux命令

    1.查找文件 find / -name filename.txt 根据名称查找/目录下的filename.txt文件. find . -name "*.xml" 递归查找所有的xm ...

  2. Browser设置UA值

    SWE Browser中的OptionMenu是Controller通过onKeyDown监听KEYCODE_MENU来显示的 public boolean onKeyDown(int keyCode ...

  3. cach

    为程序使用内存缓存(MemoryCache) oscache Guava cache 一种解决方法是配一个listener,在里面启动定时器. 简单缓存可以封装LinkedHashMap,因为它是有顺 ...

  4. maven打包时使用的pom配置

    <build> <plugins> <!-- compiler插件, 设定JDK版本 --> <plugin> <groupId>org.a ...

  5. linux 常用命令大全

    linux 常用命令大全 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统 ...

  6. 从DB灌值到DataTable时,字段值为NULL时报错相关信息;

    报错信息: 1.  2.  3.  4.  5.  6.  解决方法: 1. Data Layer SQL 语句取数据时,把其列值有为null的字段用0.00替换,(ISNULL的用法): 2. #r ...

  7. 我的WebService入门

    ERP: 1. Data Layer: (ProductInfoDBHelper.cs) /// <summary> /// 获取门店图片信息 /// </summary> p ...

  8. Magicodes.WeiChat——ASP.NET Scaffolding生成增删改查、分页、搜索、删除确认、批量操作、批量删除等业务代码

    关于T4代码生成这块,我之前写过几篇帖子,如:<Magicodes.NET框架之路——让代码再飞一会(ASP.NET Scaffolding)>(http://www.cnblogs.co ...

  9. 使用NHibernate(3)-- 用代码代替配置文件

    1,用代码配置Configure类. 上一篇“让代码跑起来”中,是通过在Web.config配置来实现Configure类的,NHibernate还提供了代码的方式. 把之前的配置都注释掉,然后修改A ...

  10. unity3d asset store下载的代码所在位置

    Asset Store下载了官方的示例,却找不到了,又不想重新下载 PC:C:\Users\PCNAME\AppData\Roaming\Unity\Asset StoreMAC:"~/Li ...