You are using safe update mode and tried to update a table without a WHERE using a KEY column
Error 1175 is returned when sql_safe_updates mode is enabled and a UPDATE or DELETE statement is executed without a WHERE clause that references an indexed column, or without a LIMIT clause. This is a safety net to prevent accidental full-table updates or deletes, common in MySQL Workbench by default.
- 1Running UPDATE table SET col = val without a WHERE clause
- 2Running DELETE FROM table without a WHERE clause
- 3A WHERE clause that does not reference any indexed (KEY) column
A DELETE without a WHERE clause is run with sql_safe_updates enabled.
SET sql_safe_updates = 1; DELETE FROM users; -- no WHERE clause
expected output
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.
Fix 1
Add a proper WHERE clause
WHEN When you intend to update or delete specific rows.
DELETE FROM users WHERE id = 42;
Why this works
A WHERE clause that references an indexed column satisfies safe update mode. The query affects only the matching rows.
Fix 2
Disable safe update mode for the session if a full-table operation is intended
WHEN When a bulk operation on all rows is deliberate.
SET sql_safe_updates = 0; TRUNCATE TABLE sessions; -- or DELETE FROM sessions; SET sql_safe_updates = 1; -- re-enable after
Why this works
Temporarily disabling safe update mode allows the full-table operation. Re-enabling it afterwards restores the safety net. Use TRUNCATE TABLE for deleting all rows — it is faster than DELETE FROM for large tables.
✕ Permanently disable sql_safe_updates in the server configuration
Safe update mode is an important last-resort protection against accidental mass deletions and updates, particularly in interactive sessions.
sql_safe_updates is a session variable. MySQL Workbench enables it by default for interactive connections.
MariaDB Server error code 1175 / ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
MariaDB sql_safe_updates ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev