首页 > 开发 > JSP > 正文

Spring boot 使用mysql实例详解

2019-10-27 17:58:52
字体:
来源:转载
供稿:网友

Spring boot 使用mysql实例详解

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

1.建立数据库:

mysql -u rootCREATE DATABASE springbootdb

2.pom.xml:

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

3.application.properties:

spring.datasource.url= jdbc:mysql://localhost:3306/springbootdbspring.datasource.username=rootspring.datasource.password=spring.jpa.hibernate.ddl-auto=create-drop//none, validate, update, create-drop

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!


注:相关教程知识阅读请移步到JSP教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表