mysql刪除500資料_MySQL資料刪除異常
阿新 • • 發佈:2020-12-27
技術標籤:mysql刪除500資料
具體報錯資訊如下:
exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1175 You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column' in /xxxx/storage/db/adapter/PDOAbstract.php:776
意思是where條件是一個非key的列且無limit,原因在於mysql設定了sql_safe_updates為ON,通過以下方式檢視
兩種解決方法:
1 把該列設定成key即可
alter table tablename add index `idx_column_name` (column_name)
2 修改mysql配置
set sql_safe_updates=0; 或 set sql_safe_updates=off;