Thursday 9 January 2014

MySQL Error 1356 mysqldump Couldn’t execute

MySQL Error mysqldump Couldn’t execute references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

If you get an error messages like “mysqldump: Couldn’t execute ‘SHOW FIELDS FROM `store_information`’: View ‘database.viewname’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)” then a number of things might be wrong:
» The view is “corrupted” (this could happen if the table the view is of has been updated in a way so that the view is no longer correct – for instance if the table structure is updated)
» The user you are using are lacking permissions (to the view/table (that the view is referencing) )
» If the database is having any temporary tables then there is a chance to get this kind of error as well.

What I usually do when this happens to solve it is to:
1.Verify if the user running the mysqldump has the permissions (or test as root if you can – as root has more permissions).
If this is the case: update the permissions on the user running the dump – or change to another user

2.Try to find out if the table the view is referencing has been updated (think back what have I done check with the rest of the team)

Or if you do not wish to/can not do this, check a previous backup up the base table (from when mysqldump worked with the view) and compare the structure with the current structure in the database.

If this is the case: I just drop the view and recreate the view so that it gets corrected in the underlying db structure and re-run the dump.

No comments:

Post a Comment