---
title: "mysql更新数据时候的一个异常"
author: "fosa0989"
date: "2011-04-18T10:35:22Z"
tags: []
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2011-04-18T10:35:22Z"
id: 1006091
url: "https://hchen229.iteye.com/blog/1006091"
---

用mysql workbench 更新一个表的时候报如下异常：

 

***Error Code: 1175. To disable safe mode, toggle the option in Preferences -&gt; SQL Editor -&gt; Query Editor and reconnect.***

***You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column***

 

使用安全更新模式的时候update语句必须使用一个关键字列属性来限定更新的范围。如果不使用关键字列来限定范围或更新所有记录的时候就不能用安全更新模式。

解决办法是执行以下语句设置为非安全更新模式.

```
SET SQL_SAFE_UPDATES=0;
```