Search code examples
mysqlsequelprodatabase-management

How do I resolve 'Unexpected number of row removed!'?


I'm trying to delete all row of data in my tables and reset the auto increment. When I do, I get this message :

Unexpected number of rows removed!

One row was not removed. Reload the table to be sure that the contents
have not changed in the meantime. Check the Console for possible errors 
inside the primary keys of this table!

update When I do TRUNCATE TABLE 'users' I get this message

    Cannot truncate a table referenced in a foreign key constraint
 (`marketing`.`designer_application`, CONSTRAINT
 `designer_application_user_id_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES 
`marketing`.`users` (`id`))

Solution

  • Likely another process acted on the same rows that you selected before you were able to delete them. If you are using the UI to delete the rows, consider using a SQL query instead. Using TRUNCATE will clear the contents of a table and reset the auto increment to 0.

    TRUNCATE TABLE `tablename`;