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

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
### The error may exist in com/itheima/mapper/BrandMapper.java (best guess)
### The error may involve com.itheima.mapper.BrandMapper.selectAll
### The error occurred while executing a query
### Cause: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
	org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
	org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
	org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
	org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
	org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
	org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
	jdk.proxy4/jdk.proxy4.$Proxy31.selectAll(Unknown Source)
	com.itheima.service.impl.BrandServiceImpl.selectAll(BrandServiceImpl.java:25)
	com.itheima.web.select.SelectAllServlet.doGet(SelectAllServlet.java:22)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

原因:显而易见的是,你数据库的用户名和密码错误,修改一下mybatis-config.xml文件就可以了

posted @ 2023-05-23 15:29  YE-  阅读(227)  评论(0编辑  收藏  举报