具体报错: 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 com/stedu/mapper/AdminMapper.xml ### The error may involve com.stedu.mapper.AdminMapper.selectByUsernameAndPassword ### 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)
个人解决方法:出现这个错误有可能是在配置文件中的数据库账号密码出现问题,将账号密码与自己mysql的账号密码统一,即可解决
不得不感叹,有时候纠结你很久的错误有可能出现在意想不到的地方