mysql刪除行 MySQL出現無法刪除行記錄

2021-10-25 14:14:30 字數 1264 閱讀 8020

今天mysql在刪除一張innodb型別的表時,出現錯誤error no. 1451

解決方法:

這可能是mysql在innodb中設定了foreign key關聯,造成無法更新或刪除資料。可以通過設定foreign_key_checks變數來避免這種情況。

set foreign_key_checks = 0;

執行刪除sql語句;

刪除完成後設定 ;

set foreign_key_checks = 1;

其他:關閉唯一性校驗

這可能是mysql在innodb中設定了foreign key關聯,造成無法更新或刪除資料。可以通過設定foreign_key_checks變數來避免這種情況。

mysql> set foreign_key_checks = 0;

query ok, 0 rows affected (0.02 sec)

mysql> delete from repositories where repo_name = "watch/sinawatch_agent_update";

query ok, 1 row affected (0.02 sec)

mysql> set foreign_key_checks = 1;

query ok, 0 rows affected (0.00 sec)

MySQL出現無法刪除行記錄

今天mysql在刪除一張innodb型別的表時,出現錯誤error no.1451 解決方法 這可能是mysql在innodb中設定了foreign key關聯,造成無法更新或刪除資料。可以通過設定foreign key checks變數來避免這種情況。set foreign key checks ...

MySQL刪除重複行

網上有些做法是這樣的 delete from table name where id not in select min id from select min id as min id from table name group by duplicate column b 發現這樣在本地跑是可行的,...

mysql行 《Mysql 行模式》

一 總結 預設的行格式定義 innodb default row format 檢視當前資料表行格式 show table status table 建立表指定行格式 create table table row format dynamic 修改錶行格式 alter table table row...