美文网首页
Spring boot 使用mysql

Spring boot 使用mysql

作者: Angeladaddy | 来源:发表于2016-11-23 14:09 被阅读78次

** 开发阶段用 H2即可,上线时,通过以下配置切换到mysql,spring boot将使用这个配置覆盖默认的H2。**

  1. 建立数据库:
mysql -u root
CREATE DATABASE springbootdb
  1. pom.xml:
<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
  1. application.properties:
spring.datasource.url= jdbc:mysql://localhost:3306/springbootdb
spring.datasource.username=root
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=create-drop//none, validate, update, create-drop

相关文章

网友评论

      本文标题:Spring boot 使用mysql

      本文链接:https://www.haomeiwen.com/subject/yphvpttx.html