728x90
728x170

Workbench 에서 Where 조건 없는 Delete 는 기본적으로 막혀 있습니다.

delete from world.test

delete from world.test where 1=1

위 명령을 실행하면 아래와 같은 메세지가 뜨고 실행되지 않습니다.

Error Code: 1175. 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.

where 조건에 Key조건이 있어야 실행이 되도록 기본으로 설정되어 있기 때문인데 

이를 푸는 방법은 상단 메뉴에서 Edit > Preferences 를 선택합니다.

 

아래 Preferences 창에서 좌측 SQL Editor 메뉴를 클릭하고 우측 아래쪽에 있는 

Safe Updates 체크박스를 해제합니다.

이렇게 하면 이제 앞서 안되었는 Where 없는 Delete 문이 동작되는 걸 확인할 수 있습니다.

728x90
그리드형
Posted by kjun
,