본문 바로가기
CS/Database

[Mysql 에러 해결] - You are using safe update mode and you tried to update a table without a WHERE the uses a KEY column...

by Jman 2022. 7. 29.

문제 발생

Mysql 에서 특정 sql문을 실행 할 때, 나오는 에러.

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

테이블 키 값을 이용한 update, delete 만 허용하도록 되어 있는데, 그렇지 않게 좀 더 넓은 범위로  sql 문을 실행할 때, workbench 에서 경고를 줌. 즉, 다수의 데이터를 update, delete 할 때, 발생됨.

 

 

해결 방법1

sql 로 환경변수를 설정해준다. 

SET SQL_SAFE_UPDATES = 0;

 

해결 방법2

기본 설정인 안전 모드를 해제하기

순서.
MySQL Workbench => [ Preferences ] => [ SQL Editor ] => Uncheck "Safe Udates (rejects......)"

 

(기본) Safe Updates 가 체크 되어있는 상태
* 체크를 푼다. -> Ok.

참고

https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench

 

MySQL error code: 1175 during UPDATE in MySQL Workbench

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:

stackoverflow.com