MySQLMySQL 1175

MySQL 1175: Safe Update Mode — No WHERE with Key

MySQL 1175 is raised when safe-updates mode (--safe-updates) is enabled and an UPDATE or DELETE statement does not include a WHERE clause that uses a key column. This protects against accidental mass updates.

Example Query

UPDATE users SET active = 0;
-- Blocked in safe-updates mode: no key in WHERE

Common Causes

  1. 1Running UPDATE or DELETE without a WHERE clause in MySQL Workbench (safe mode is on by default)
  2. 2WHERE clause exists but does not reference a primary key or indexed column
  3. 3Intentional mass update blocked by the safety feature

How to Fix It

Add a WHERE clause that uses a key column. To intentionally update all rows, disable safe mode for the session: SET SQL_SAFE_UPDATES = 0; UPDATE …; SET SQL_SAFE_UPDATES = 1;. In MySQL Workbench, uncheck 'Safe Updates' under Preferences.

Need a reliable database?

Try Supabase — free PostgreSQL with a generous free tier. No credit card required.

Get started free →

Got a query causing this error?

Paste it into SQLbuddy and get an instant plain-English explanation with optimization tips.

Analyze My Query →