YB的小三
2017-11-19 07:22SpringBoot+MyBaits+MySQL连接数据库出错,求大神指点配置
报错如下:
2017-11-19 15:13:40.009 ERROR 15152 --- [nio-8090-exec-2] e.n.y.o.service.LoginModuleService : checkUserInfo: Error message 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 java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
The error may exist in file [D:\Spring\JavaWeb\OnlineBookstore\target\classes\mybatis\mapper\UserInfoMapper.xml]
The error may involve edu.javaee.onlinebookstore.mapper.UserInfoMapper.isNameExist
The error occurred while executing a query
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
application.properties配置如下:
server.port = 8090
spring.mvc.view.prefix = /WEB-INF/jsp/
spring.mvc.view.suffix = .jsp
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/onlinebookstore?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username = root
spring.datasource.password = root
mybatis.typeAliasesPackage = edu.javaee.onlinebookstore.domain
mybatis.config-location = classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations = classpath:mybatis/mapper/*Mapper.xml
logging.file = log/service.log
检查过数据库密码正确,可以通过Navicat访问。
- 点赞
- 回答
- 收藏
- 复制链接分享
4条回答
为你推荐
- 一个关于mybaits的小问题(Sql Server数据库)
- spring
- java
- maven
- intellij-idea
- sql
- 2个回答
- 尝试使用UNION ALL查询两个表时出错
- union
- mysql
- php
- 3个回答
- SpringBoot+MybatisPlus可以实现有角色菜单关系数据,将关系数据一起删除吗
- java
- intellij-idea
- 2个回答
- springboot+mybatis 项目 配置多个数据源(mysql和oracle)出错,请大神帮忙看看,急急急!!!跪谢!!!
- spring
- oracle
- java
- mysql
- 1个回答
- SpringBoot集成Mybatis遇到问题
- mybatis
- spring
- 2个回答