mysql报错1785_执行MySql更新报错:error code [1785]

应用连接MySql数据库,报错,报错信息如下:

### Error updating database. Cause: java.sql.SQLException: When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1,

updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions,

and never in the same statement as updates to transactional tables.

### Cause: java.sql.SQLException: When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.

; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1785]; When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.; nested exception is java.sql.SQLException: When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.

error code [1785]

通过各种查询发现是建表语句和数据库版本的的问题。

本地服务器版本:5.1.73

服务器版本:5.6

而在建表语句中,表的类型为:

ENGINE=MyISAM

改为:InnoDB类型即可。更改的地方在:

ff468f84f765fb227f47cfd4993adbe1.png

再次执行,SQL即可成功执行。

InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持。MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,但是不提供事务支持,而InnoDB提供事务支持已经外部键等高级数据库功能。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值