Deciphering MySQL Error 1134 (ER_UPDATE_INFO): Understanding Row Matching in Updates

When working with MySQL, you might encounter Error 1134 – SQLSTATE: HY000 (ER_UPDATE_INFO), which is not so much an error as it is a message providing information after executing an UPDATE statement. The message Rows matched: %ld Changed: %ld Warnings: %ld gives you a breakdown of the number of rows that matched the WHERE clause criteria, how many were actually changed, and the number of warnings that occurred during the operation. This message can help you understand the behavior of your UPDATE statements and diagnose potential issues.

Understanding the Message

This informational message is MySQL’s way of telling you the outcome of an UPDATE operation. It is important because it can indicate cases where rows may match the criteria but are not changed because the new value is the same as the old value, or due to the use of SAFE UPDATES mode, which prevents updates without a key in the WHERE clause or a limit in the UPDATE.

Diagnosing the Issue

To diagnose the issue, you need to examine the UPDATE statement and the table’s data. Check for the following:

  • Are the values being updated actually different from the existing values?
  • Is the WHERE clause written correctly to match the intended rows?
  • Are there any triggers or constraints on the table that might prevent the update?
  • Is SAFE UPDATES mode enabled which might be preventing the update?

Example Scenarios and Fixes

Scenario 1: Updating to the Same Value

Problem: The UPDATE statement is setting a column to its current value.

UPDATE users SET name = 'John Doe' WHERE name = 'John Doe';
-- Rows matched: 1 Changed: 0 Warnings: 0

Fix: Ensure the new value is different from the old value.

Scenario 2: Incorrect WHERE Clause

Problem: The WHERE clause does not match any rows.

UPDATE users SET name = 'Jane Doe' WHERE id = 999;
-- Rows matched: 0 Changed: 0 Warnings: 0

Fix: Correct the WHERE clause to match the intended rows.

Scenario 3: Triggers or Constraints

Problem: A trigger or constraint is preventing the update.

-- Assuming there is a trigger that prevents updating username to 'admin'
UPDATE users SET username = 'admin' WHERE id = 1;

Fix: Modify or remove the trigger or constraint that is interfering with the update.

Scenario 4: SAFE UPDATES Mode

Problem: SAFE UPDATES mode is enabled, preventing updates without a key in the WHERE clause.

UPDATE users SET name = 'Jane Doe';
-- Error: You are using safe update mode...

Fix: Use a key in the WHERE clause or disable SAFE UPDATES mode.

UPDATE users SET name = 'Jane Doe' WHERE id = 1; -- Using a key


MySQL Error 1134 provides valuable information about the result of an UPDATE operation. Understanding this message can help you ensure that your UPDATE statements are functioning as intended. By examining the UPDATE statement, the table’s data, and any relevant database settings, you can diagnose and address issues that may be preventing your updates from taking effect as expected.

Leave a Comment