🌞執行以下語法
update ${table_name}
set ${column_name}=${value}
where id is null;
--範例如下
update member
set id=1
where id is null;
☀️ 產生
Error Code: 1175.You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences
☀️ 解決方式
set SQL_SAFE_UPDATES=0;/*關閉安全模式*/
☀️ 原因
因MySQL為資料庫安全起見,SQL_SAFE_UPDATES預設為開啟,會將UPDATE、DELETE語法擋住,於是只要將該參數關閉,就可以解決這個問題
You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences
從這段錯誤訊息中也可以得知,我們正在使用安全更新模式,如要取消可以切換預設選項。
謝謝你的閱讀:)
如果你喜歡我的分享
歡迎底下留言或來信至boomengineerli@gmail.com 與我分享
期待與更多優秀的夥伴交流😄
— — — — — — — — — — — — — — — — — — — — — — — —
如果願意給我一些小小鼓勵,請給我1–10個拍手
如果覺得文章對你有點幫助,請給我11–20個拍手
如果想看更多程式的相關文章,請長按拍手按鈕(50個拍爆)讓我知道唷👏
最後,如希望持續追蹤我的最新文章,請不要忘記追蹤 Boom ⭐️ 程式自學之旅 謝謝~🙌