Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was considering why some special commands in mysql like create user, grant privileges, drop user when correct passed return "0 rows affected", which is not true! (rows in mysql db are affected indeed)

I know there are not standard queries, but if we do delete from user where ... on mysql database, we will see N rows affected.

so it's countable in rather easy way.
otherwise response "Query OK (0.00 sec)" will be much accurate.

or am I missing sth? I verify above with a few mysql version 5.1-5.5.

share|improve this question

migrated from Jun 19 '13 at 2:39

This question came from our site for professional and enthusiast programmers.

The way mysql works is this ...

Performing INSERTs, UPDATEs, DELETEs explicitly names tables

SQL Commands that do not explicitly name tables have 0 row(s) affected

Such commands that echo 0 row(s) affected include

  • CHANGE MASTER TO (to Setup MySQL Replication)

I suppose this has always been the case.

share|improve this answer

You're right it's a little bit confusing but it's not a bug. See MySQL Documentation for the TRUNCATE command:

Truncation operations do not return a meaningful value for the number of deleted rows. The usual result is “0 rows affected,” which should be interpreted as "no information".


share|improve this answer
This is actually a problem of the SQL client rather than "MySQL" itself. Not all clients behave this way. – a_horse_with_no_name Jun 19 '13 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.