三、连接数据库
1.编写文件
在resources包下找到application.properties,将如下代码写入:
spring.datasource.username=root
spring.datasource.password=admin
spring.datasource.url=jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
??mybatis
mybatis.type-aliases-package=com.example.springboot.pojo
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
2.连接MySQL