赞
踩
IDE:IntelliJ IDEA Ultimate 2019.3 (我用的是学生版,只要大学邮箱能用就可以的)
报错信息全文附在最后。其中关键的信息就是:
Root Cause
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
1.首先,如果项目是你下载的,数据库的账户密码一定都要改好。
2.设置Mysql初始化root密码和允许远程访问:
(1)进入mysql数据库
mysql>update user set password=PASSWORD(‘123456’) where User='root';
(2)授权使Mysql被允许远程访问
- mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
- mysql>FLUSH PRIVILEGES;
- Exception
-
- org.springframework.web.util.NestedServletException: Request processing failed; nested exception is 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 file [/Users/ching_shing/Downloads/JavaEETest-master/MyBlog/target/MyBlog/WEB-INF/classes/mapping/ArticleMapper.xml]
- ### The error may involve org.sang.dao.ArticleDao.getFirst10Article
- ### 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.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
- org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
- javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
- org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
- javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
- org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
- Root 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 file [/Users/ching_shing/Downloads/JavaEETest-master/MyBlog/target/MyBlog/WEB-INF/classes/mapping/ArticleMapper.xml]
- ### The error may involve org.sang.dao.ArticleDao.getFirst10Article
- ### 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:77)
- org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
- com.sun.proxy.$Proxy27.selectList(Unknown Source)
- org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
- org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
- org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
- org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
- com.sun.proxy.$Proxy28.getFirst10Article(Unknown Source)
- org.sang.service.ArticleService.getFirst10Article(ArticleService.java:29)
- org.sang.controller.ArticleController.index(ArticleController.java:33)
- java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- java.base/java.lang.reflect.Method.invoke(Method.java:564)
- org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
- org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
- org.springframework.web.servlet.mvc.metho
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。