카테고리 없음

[MySQL] Safe Mode 해제 (Error Code : 1175 해결방법)

fkavpfm 2022. 9. 13. 11:04
delete from user where age = 0; 
delete from user where age = 0 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. 0.000 sec

테이블에서 키값을 이용한 하나의 레코드만을 update, delete하도록 설정되어 있는데, 다수의 레코드를 update나 delete하는 sql명령어가 실행되어 문제가 발생

해결방법은 

set sql_safe_updates=0; // 일시적으로 안전모드 해제 0을 1로 바꾸면 다시 안전모드로 되돌릴 수 있음
Workbench Preferences에서 안전모드를 해제한후에 workbench 재시작 // 항상 안전모드 해제