괴발개발 성장기

Study/Mysql

[MySQL] update 할 때 나오는 에러 메시지

지니유 2023. 7. 5. 15:00
반응형

MySQL Workbench에서 업데이트 할 때 조건이 없으면 데이트를 보호하기 위해서 에러가 난다.

 

 

# 에러 메시지

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

# 해결방법

1)  Update 문 전에 아래 코드를 실행한다.

set sql_safe_updates=0;
update members set name ='지니';

 

2) update문에 조건을 넣는다

update members set name ='지니' where id >0;

 

3) MySQL Workbench에서 설정한다.

setting으로 들어가서 SQL Editor에 들어간다. 그리고 Safe Updates에 체크를 해지하면 된다.

 

 

반응형