Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
477 views
in Technique[技术] by (71.8m points)

mysql - MySQL错误代码:MySQL Workbench中UPDATE期间的1175错误代码(MySQL error code: 1175 during UPDATE in MySQL Workbench)

I'm trying to update the column visited to give it the value 1. I use MySQL workbench, and I'm writing the statement in the SQL editor from inside the workbench.

(我正在尝试更新visited的列以赋予它值1.我使用MySQL工作台,并且我在工作台内部在SQL编辑器中编写语句。)

I'm writing the following command:

(我正在编写以下命令:)

UPDATE tablename SET columnname=1;

It gives me the following error:

(它给了我以下错误:)

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 ....

(您正在使用安全更新模式,并且您尝试更新没有使用KEY列的WHERE的表要禁用安全模式,请切换选项....)

I followed the instructions, and I unchecked the safe update option from the Edit menu then Preferences then SQL Editor .

(我按照说明操作,然后从Edit菜单中取消选中safe update选项,然后取消选择Preferences然后选择SQL Editor 。)

The same error still appear & I'm not able to update this value.

(仍然出现相同的错误,我无法更新此值。)

Please, tell me what is wrong?

(拜托,告诉我有什么问题?)

  ask by Jury A translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It looks like your MySql session has the safe-updates option set.

(看起来您的MySql会话设置了safe-updates选项 。)

This means that you can't update or delete records without specifying a key (ex. primary key ) in the where clause.

(这意味着如果不在where子句中指定密钥(例如primary key ),则无法更新或删除记录。)

Try:

(尝试:)

SET SQL_SAFE_UPDATES = 0;

Or you can modify your query to follow the rule (use primary key in where clause ).

(或者,您可以修改查询以遵循规则(在where clause使用primary key )。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...