一个专注于大数据技术架构与应用分享的技术博客

MySQL报错: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 -> SQL Editor and reconnect. 0.032 sec

在MySQL中执行UPDATE语句,报如下错误:

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 -> SQL Editor and reconnect.	0.032 sec

这是因为MySql运行在safe-updates模式下,该模式会导致非主键条件下无法执行update或者delete命令。而只允许基于主键进行更新。

解决方法一:

执行如下命令,修改数据库模式:

SET SQL_SAFE_UPDATES = 0;

解决方法二:

在UPDATE的语句中,WHERE条件后使用主键字段进行限定更新的范围。

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《MySQL报错: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 -> SQL Editor and reconnect. 0.032 sec》
文章链接:https://macsishu.com/mysql%e6%8a%a5%e9%94%99%ef%bc%9aerror-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-pre
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。