๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Study

[MySQL] MySQL safe mode ํ•ด์ œ - Error Code : 1175

by JulesJ 2022. 7. 29.
728x90

MySQL safe mode ํ•ด์ œ - Error Code : 1175

 

๊ฐœ๋ฐœํ™˜๊ฒฝ

macOS Monterey ver 12.5
MySQLWorkbench ver.8.0.25

 

์—๋Ÿฌ ๋ฐœ์ƒ

 

๋Œ€๋žต ์•„๋ž˜ ๊ฐ™์€ ์ฟผ๋ฆฌ์™€ ๊ฐ™์ด, ํ•œ ์กฐ๊ฑด์œผ๋กœ ์—ฌ๋Ÿฌ ๊ฐœ์˜ records๋ฅผ ํ•œ๊บผ๋ฒˆ์— ์—…๋ฐ์ดํŠธํ•˜๋ ค๊ณ  ํ•˜๋‹ˆ ํ•ด๋‹น ์—๋Ÿฌ๋ฅผ ๋งŒ๋‚ฌ๋‹ค.

update boards
set del = 1
where ref = 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.

 

์—๋Ÿฌ์˜ ์›์ธ

MySQL์˜ ํ…Œ์ด๋ธ”์—์„œ ๊ธฐ๋ณธ์œผ๋กœ๋Š”, key๊ฐ’์„ ์ด์šฉํ•œ update๋‚˜ delete๋งŒ์„ ํ—ˆ์šฉํ•˜๋„๋ก ๋˜์–ด ์žˆ๋‹ค.
ํ•˜์ง€๋งŒ ๊ทธ๋ ‡๊ฒŒ ํ•˜์ง€ ์•Š๊ณ  ๋„“์€ ๋ฒ”์œ„์—(์—ฌ๋Ÿฌ๊ฐœ์˜ records๋ฅผ ํ•œ๊บผ๋ฒˆ์—) update ํ˜น์€ delete๋ฅผ ์ ์šฉํ•˜๋ ค๊ณ  ํ•ด์„œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์ด๋‹ค.
์ฆ‰, ํ•œ ๊ฐœ์˜ record๋งŒ์„ update, delete ํ•˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ์ง€๋งŒ, ์—ฌ๋Ÿฌ ๊ฐœ์˜ records๋ฅผ update๋‚˜ deleteํ•˜๋Š” sql๋ฌธ์ด ์‹คํ–‰๋˜์–ด์„œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์ด๋‹ค.

 

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

 

1. ์ผ์‹œ์ ์ธ safe mode ํ•ด์ œํ•˜๊ธฐ

SET SQL_SAFE_UPDATES = 0;

 

2. MySQL Workbench์—์„œ safe mode ํ•ด์ œํ•˜๊ธฐ

 

(1) MySQLWorkbench > Preferences

 

(2) Preferences > SQL Editor

Other ๋ถ€๋ถ„์— safe Updates.. ๋ถ€๋ถ„์„ ์ฒดํฌ ํ•ด์ œํ•œ๋‹ค.

์ฒดํฌ ๋ฐ•์Šค๋ฅผ ํ•ด์ œํ•œ ํ›„ ๋‹ค์‹œ ์›Œํฌ๋ฒค์น˜๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.

 

์•ˆ์ „๋ชจ๋“œ๋ฅผ ํ•ด์ œํ•˜๊ณ  ํ•ด๋‹น ์ฟผ๋ฆฌ๋ฅผ ์žฌ์‹คํ–‰ํ•˜๋‹ˆ ์ •์ƒ์ ์œผ๋กœ ์ˆ˜ํ–‰๋œ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค!

โฌ‡๏ธ

 

 

Reference

https://chunggaeguri.tistory.com/entry/MySQL-Error-Code-1175

 

 

 

 

๋ ๐Ÿง

๋Œ“๊ธ€