目录
3 出错类型三(XXXMapper.xml中SQL语句语法问题)
1 出错类型一(连接MySQL失败)
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'root'@'127.0.0.1' to database 'db_onlineexam'
解决:重新安装mysql
2 出错类型二(MySQL密码错误)
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
Bug:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
### The error may exist in file [D:\IdeaProjects\onlineExam\target\classes\mapper\UserMapper.xml]
### The error may involve com.nenusoftware.onlineexam.mapper.UserMapper.selectByName
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
解决:仔细查看Bug里面的Cause一行,检查用户名和密码是否正确
3 出错类型三(XXXMapper.xml中SQL语句语法问题)
解决:检查sql语句是否正确