mysql Statement violates GTID consistency 的坑

來源:互聯網
上載者:User

標籤:

今天項目遷移,重新換了一個資料庫版本,然後問題來了,原本運行正常的程式遷移過來之後就是不能正常運行,後台報錯如下:

update tbl_user_info set -- 強制下架 mv_count = mv_count-1, update_time=now() where user_id = ?; update tbl_user_info a,tbl_mv_like b set a.enjoy_num = a.enjoy_num -1, a.update_time = now() where b.mvlikeId = ? and b.userId =a.user_id and b.userId != ? and b.isLIke = 1 and b.state = 0
### Cause: java.sql.SQLException: Statement violates GTID consistency: 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]; Statement violates GTID consistency: 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: Statement violates GTID consistency: 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.

網上查了一下 Statement violates GTID consistency這個,然後看到這個網頁https://dev.mysql.com/doc/refman/5.6/en/replication-options-gtids.html,一開始還以為是資料庫模式的問題,後面看了下資料庫表,才知道原來是營運人員在新的資料庫上把我的資料庫表的模式設定成了MyISAM這個模式,然後去資料庫show engines了一下,

可以看到,這個模式是不支援事物的,將它修改為InnoDB,問題搞定

mysql Statement violates GTID consistency 的坑

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.