MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEM
1:錯(cuò)誤日志大量錯(cuò)誤
150602 14:40:02 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave. Statement:INSERT INTO tab_name
2:原因:
查了下原因,tab_name 這個(gè)表上有2個(gè)唯一鍵。則使用INSERT … ON DUPLICATE KEY UPDATE ,且當(dāng)前數(shù)據(jù)庫(kù)binlog_format是statement格式,這種sql語(yǔ)句就會(huì)報(bào)unsafe。
官方手冊(cè):
INSERT … ON DUPLICATE KEY UPDATE statements on tables with multiple primary or unique keys.When executed against a table that contains more than one primary or unique key, this statement is considered unsafe, being sensitive to the order in which the storage engine checks the keys, which is not deterministic, and on which the choice of rows updated by the MySQL Server depends.
解決方法:
把binlog_format設(shè)置為ROW或者STATEMENT或者修改SQL。
一般情況下就是mysql配置問題,大家可以參考這篇文章:http://www.dhdzp.com/article/84357.htm
- MySQL 將文件導(dǎo)入數(shù)據(jù)庫(kù)(load data Statement)
- MySQL?如何將查詢結(jié)果導(dǎo)出到文件(select?…?into?Statement)
- MySQL?Prepared?Statement?預(yù)處理的操作方法
- MySQL?binlog格式之Row和Statement語(yǔ)句詳解
- The MySQL server is running with the --read-only option so it cannot execute this statement
- 詳解JSP中的語(yǔ)句對(duì)象Statement操作MySQL的使用實(shí)例
- 解決mysql報(bào)錯(cuò)You must reset your password using ALTER USER statement before executing this statement問題
相關(guān)文章
MySQL?遷移OB?Oracle場(chǎng)景中自增主鍵實(shí)踐操作
這篇文章主要介紹了MySQL?遷移OB?Oracle場(chǎng)景中自增主鍵實(shí)踐操作詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-10-10
mysql慢查詢優(yōu)化之從理論和實(shí)踐說明limit的優(yōu)點(diǎn)
今天小編就為大家分享一篇關(guān)于mysql慢查詢優(yōu)化之從理論和實(shí)踐說明limit的優(yōu)點(diǎn),小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2019-04-04
如何使用分區(qū)處理MySQL的億級(jí)數(shù)據(jù)優(yōu)化
mysql在查詢上千萬(wàn)級(jí)數(shù)據(jù)的時(shí)候,通過索引可以解決大部分查詢優(yōu)化問題。但是在處理上億數(shù)據(jù)的時(shí)候,應(yīng)該怎么解決,本文就是用分區(qū)來優(yōu)化一下,感興趣的一起來了解一下2021-06-06
mysql中l(wèi)ike % %模糊查詢的實(shí)現(xiàn)
這篇文章主要介紹了mysql中l(wèi)ike % %模糊查詢的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12
MySQL數(shù)據(jù)庫(kù)添加外鍵的四種方式
這篇文章主要介紹了ysql數(shù)據(jù)庫(kù)添加外鍵的四種方式, 建表時(shí)直接使用FOREIGN KEY,建表時(shí)使用CONSTRAINT,在建表以后使用ALTER語(yǔ)句以及 使用第三方工具這四種方式,需要的朋友可以參考下2024-03-03

