1175ERRORTier 2 — Caution✅ HIGH confidence

You are using safe update mode and tried to update a table without a WHERE using a KEY column

Category: SafetyVersions: All MariaDB / MySQL versions

What this means

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.

Why it happens

  1. 1Running UPDATE table SET col = val without a WHERE clause
  2. 2Running DELETE FROM table without a WHERE clause
  3. 3A WHERE clause that does not reference any indexed (KEY) column

How to reproduce

A DELETE without a WHERE clause is run with sql_safe_updates enabled.

trigger — this will ERROR
SET sql_safe_updates = 1;
DELETE FROM users;  -- no WHERE clause
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 you intend to update or delete specific rows.

fix
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 a bulk operation on all rows is deliberate.

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

What not to do

Permanently disable sql_safe_updates in the server configuration

Why it's wrong: Safe update mode is an important last-resort protection against accidental mass deletions and updates, particularly in interactive sessions.

Version notes

All versionssql_safe_updates is a session variable. MySQL Workbench enables it by default for interactive connections.

Sources

📚 Official docs: https://mariadb.com/kb/en/server-system-variables/#sql_safe_updates

🔧 Source ref: MariaDB Server error code 1175 / ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE

📖 Further reading: MariaDB sql_safe_updates

Confidence assessment

✅ HIGH confidence

Stable. Safe update mode semantics are consistent across versions.

See also

⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →