oot cause
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 cn/itcast/ssm/mapper/ItemsMapperCustom.xml
The error may involve cn.itcast.ssm.mapper.ItemsMapperCustom.findItemsList
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))
org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
工程代码放在在虚拟机win10下跑没有问题,在我本机上一直报这个错误,数据库服务器连接的都是一样的地址
怀疑你localhost的密码只支持自己连接,有可能不识别或者未授权,根据错误来看是不允许,所以你可以试着吧root@localhost:改为你数据库所在的ip地址,或者用其他用户来连接试一试;
尽量不要用localhost来映射数据库连接,而用固定ip地址来代替。