🐾   [MySQL] Mysql Workbench에서 Update문을 안전하게 사용하는 방법

배경

DB 업데이트를 하려고 하는 아래와 같은 에러 메시지가 나왔다.

에러 메시지

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.

해결 방안

  1. 업데이트 문을 적기 전에
set sql_safe_updates=0;

실행 시킨 후에 업데이트를 하자!

  1. 업데이트 문 조건에 id>0 를 적는다. 예를 들어서
update members set email='genie201207@gmail.com'  where id=334 and id>0;
  1. 워크벤치에서 직접 설정을 한다
  • 상단에 Edit - Preferences를 누른다. image
  • safe Updateds를 체크 해지 한다.