2019-12-21 15:42:46.546 ERROR 8724 — [nio-8080-exec-1] com.zaxxer.hikari.pool.HikariPool : root - Exception during pool initialization.
java.sql.SQLException: Access denied for user ‘’@'192.168.132.* ’ (using password: YES)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.18.jar:8.0.18]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.18.jar:8.0.18]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.18.jar:8.0.18]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.18.jar:8.0.18]
at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.18.jar:8.0.18]
2019-12-21 15:42:46.580 ERROR 8724 — [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [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: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ‘’@‘192.168.132.105’ (using password: YES)
###The error may exist in com/wkcto/springboot/mapper/StudentMapper.xml
###The error may involve com.wkcto.springboot.mapper.StudentMapper.selectByPrimaryKey
###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 ‘’@‘192.168.132.*’ (using password: YES)] with root cause
这里提示自己电脑主机IP不能通信:java.sql.SQLException: Access denied for user ‘’@‘192.168.132.*’ (using password: YES)
原因:主配置文件application.properties 中的数据库配置出错:spring.datasource.name=root
修改:spring.datasource.username=root
用户名一定要使用username