默认创建数据表使用的引擎是MyISAM

2018-05-14 14:16:37.283  INFO 7328 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
Hibernate: drop table if exists hua_yang_area
Hibernate: drop table if exists model_entity
Hibernate: create table hua_yang_area (id bigint not null auto_increment, create_date datetime not null, create_id varchar(255) not null, uid varchar(255) not null, update_date datetime, update_id varchar(255), area_name varchar(255) not null, area_person bigint not null, primary key (id)) engine=MyISAM
Hibernate: create table model_entity (key1 varchar(255) not null, key2 varchar(255) not null, key3 varchar(255) not null, password varchar(255), user_name varchar(255), primary key (key1, key2, key3)) engine=MyISAM

配置和之前spring boot中一样

server.port=

#datasource
spring.datasource.continue-on-error=false
spring.datasource.url=jdbc:mysql://localhost:3306/swapping?useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.jpa.database=mysql
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

但是如上所示,创建的mysql数据表 引擎为MyISAM

如果想创建时使用InnoDB引擎的话,需要在配置上加上【并且注意,要将方言删除】

添加这一句:
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect 删除这一句:
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

重新启动:

===========================================================

完整配置如下:

server.port=9666

#datasource
spring.datasource.continue-on-error=false
spring.datasource.url=jdbc:mysql://localhost:3306/swapping?useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.jpa.database=mysql
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect

==========================================================

为什么使用InnoDB引擎,而不用MyISAM引擎?

因为前者支持事务,而后者不支持事务。

=========================最后,补充一点,这个和什么时候用有关系===================================

在上面配置中采用不同的方言,就能在创建数据表的时候使用不同的引擎去创建。

但是去查看源码,发现

MySQL5InnoDBDialect

已经被废弃了。

最后找到 其实  MySQL57Dialect 和 MySQL55Dialect

就可以创建InnoDB引擎。

所以就根据mysql的版本,采用合适的方言策略即可。例如,我是用的mysql5.5的所以就最后使用

【spring boot】spring boot 2.0 项目中使用mysql驱动启动创建的mysql数据表,引擎是MyISAM,如何修改启动时创建数据表引擎为【spring boot 2.0】的更多相关文章

  1. 在Springboot2.0项目中使用Druid配置多数据源

    在Springboot出现之前配置数据源以及相关的事物,缓存等内容一直是个繁琐的工作,但是Springboot出现后这些基本都可以靠默认配置搞定,就变得很轻松了.这就是现在推崇模板>配置的原因, ...

  2. ASP.NET CORE MVC 2.0 项目中引用第三方DLL报错的解决办法 - InvalidOperationException: Cannot find compilation library location for package

    目前在学习ASP.NET CORE MVC中,今天看到微软在ASP.NET CORE MVC 2.0中又恢复了允许开发人员引用第三方DLL程序集的功能,感到甚是高兴!于是我急忙写了个Demo想试试,我 ...

  3. vue2.0项目中使用Ueditor富文本编辑器示例

    最近在vue项目中需要使用富文本编辑器,于是将Ueditor集成进来,作为公共组件. 在线预览:https://suweiteng.github.io/vue2-management-platform ...

  4. 如何在vue2.0项目中引用element-ui和echart.js

    1 项目中怎样添加elment-ui 和 echart.js 1.1直接在packjson 里面的 dependencies 配置 "element-ui": "^1.3 ...

  5. Vue cli2.0 项目中使用Monaco Editor编辑器

    monaco-editor 是微软出的一条开源web在线编辑器支持多种语言,代码高亮,代码提示等功能,与Visual Studio Code 功能几乎相同. 在项目中可能会用带代码编辑功能,或者展示代 ...

  6. 把VueThink整合到已有ThinkPHP 5.0项目中

     享 关键字: VueThink ThinkPHP5.0 Vue2.x TP5 管理后台扩展 VueThink初认识 VueThink,是一个很不错的技术框架,由广州洪睿科技的技术团队2016年研发( ...

  7. maven新建Spring MVC + MyBatis + Oracle的Web项目中pom.xml文件

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  8. vue2.0项目中 localhost改成ip地址访问

    这里 你可以写成你的ip  那你的项目只能ip访问了,但是写成0.0.0.0的话 你既可已localhost 访问也可以ip访问 也可以写成 127.0.0.1也可以,也能local访问了和ip访问( ...

  9. vue2.0项目中使用Ueditor富文本编辑器应用中出现的问题

    1.如何设置config中的内容 readonly:true,//只读模式wordCount:false,//是否开启字数统计enableAutoSave: false,//自动保存功能 重点:ena ...

随机推荐

  1. 微信公众号开发java框架:wx4j(入门篇)

    导航 入门 http://www.cnblogs.com/2333/p/6617819.html WxServlet介绍 MaterialUtils 素材工具类使用说明 http://www.cnbl ...

  2. 华为手机怎么安装Google

    华为手机怎么安装google 新买了个华为荣耀九,结果安装Google Play提示gms core 步骤一 gms 安装器.应用市场已经下架了  地址:链接: 点击打开链接 密码: m63j 步骤二 ...

  3. free、vmstat监视内存使用情况

    9. free 查询可用内存 free工具用来查看系统可用内存: /opt/app/tdev1$free total used free shared buffers cached Mem: 8175 ...

  4. PB数据窗口中的几种状态及应用

    数据窗口的状态主要有以下几种: 1)New! 2)NewModified! 3)DataModified! 4)NotModified! 数据窗口可以利用这些状态标志判断数据是否被修改过. 记录和字段 ...

  5. HDU 4585 Shaolin(Treap找前驱和后继)

    Shaolin Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Su ...

  6. GYM - 101147 J.Whistle's New Car

    题意: 给出一颗有点权和边权的树.求每一个点u的子树中有多少点v,使得点v到点u的距离小于等于点v的权值. 题解: 对于每一个点,倍增的预处理出他的祖宗节点及距离.根据预处理的结果求出每个点能到的最远 ...

  7. Registering RHEL6 Clients into spacewalk

    Before Starting(login to spacwalk server) 1.Create a base channel within Spacewalk (Channels > Ma ...

  8. 看得懂的区块链,看不清的ICO人心【转】

    比特币又开始下跌了,是狂欢尽头还是又一波调整,无从得知,背后的乱象会让监管者继续心烦,而这乱象对我来说,有时候会有些心寒. 你说我怎么可能想到,我一个写程序的人,突然有一天会发现,朋友圈里有一些搞技术 ...

  9. 2590: [Usaco2012 Feb]Cow Coupons

    2590: [Usaco2012 Feb]Cow Coupons Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 306  Solved: 154[Su ...

  10. aiohttp的学习

    https://hubertroy.gitbooks.io/aiohttp-chinese-documentation/content/aiohttp%E6%96%87%E6%A1%A3/Client ...