MySQL error code: 1175 during UPDATE in MySQL Work

2018-12-31 23:29发布

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

I followed the instructions, and I unchecked the safe update option from the Edit menu then Preferences then SQL Editor. The same error still appear & I'm not able to update this value. Please, tell me what is wrong?

16条回答
余欢
2楼-- · 2019-01-01 00:02

Run this quary first :

SET SQL_SAFE_UPDATES = 0;

查看更多
荒废的爱情
3楼-- · 2019-01-01 00:04
  1. Preferences...
  2. "Safe Updates"...
  3. Restart server

Preferences...

Safe Updates Restart server

查看更多
怪性笑人.
4楼-- · 2019-01-01 00:04

The simplest solution is to define the row limit and execute. This is done for safety purposes.

查看更多
孤独寂梦人
5楼-- · 2019-01-01 00:05

If you are in a safe mode, you need to provide id in where clause. So something like this should work!

UPDATE tablename SET columnname=1 where id>0
查看更多
登录 后发表回答