Spring Boot MySQL数据库连接

1. 导入MySQL依赖

		<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

2. application.yml中配置

spring:
  datasource:
    url: jdbc:mysql://IP地址:端口号/数据库名?serverTimezone=GMT%2B8&useServerPrepStmts=true&rewriteBatchedStatements=true
    username: 数据库用户名
    password: 数据库密码
3. Spring Boot MySQL数据库连接成功!!!
原创文章 35 获赞 14 访问量 4804

猜你喜欢

转载自blog.csdn.net/weixin_39128265/article/details/90735146