1.确保数据库的url地址,用户名以及密码、端口号没有错误
下面是我的application.yml文件代码:
mybatis:
config-location: classpath:mybatis/mybatiscfg.xml
mapper-locations: classpath:mybatis/mapper/*.xml
type-aliases-package: com.neu.vo
server:
port:9696
servlet:
context-path: /neu
spring:
application:
name: sm
datasource:
driver-class-name:com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/userdb?useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: 123456
分页配置
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: count=countSql
2.自己的sql语句格式写错了吗?注意该有的空格!!!
本文介绍了一个基于MyBatis的Spring Boot项目的配置细节,包括数据库连接参数、MyBatis配置以及分页插件PageHelper的具体设置。通过检查这些配置可以解决常见的连接失败和SQL语法错误问题。
3万+

被折叠的 条评论
为什么被折叠?



