17

When dumping a database, I'm getting

mysqldump: Couldn't execute 'show create table `some_table`': execute command denied to user 'some_user'@'%' for routine 'some_routime' (1370)

and then the dumping just stops.

How do I make mysqldump continue when it runs into these sorts of problems? 10 minutes of Google has offered no help.

Here is the command I used:

mysqldump -u username -h localhost --port=4406 -p --databases database_name --skip-lock-tables --force > database_name.sql
Chad Johnson
  • 489
  • 2
  • 7
  • 14

2 Answers2

33

man mysqldump

-f, --force         Continue even if we get an sql-error.
Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
chocripple
  • 2,109
  • 14
  • 9
  • Okay, I thought this was failing, but apparently it did work. The dump seems to have finished, but the errors just so happened to have occurred toward the end, so it made it look like the errors made the dump fail. – Chad Johnson Aug 17 '11 at 16:30
  • He has already provided the --force option in the command he showed us. – Zoredache Aug 17 '11 at 16:31
  • 1
    sorry didn't realize. – chocripple Aug 17 '11 at 16:33
  • 1
    @Chad Johnson, a person might argue that if you cannot get a clean backup without using --force, then your backup did fail. The force option will suppress errors that may be important. Please do not use --force in a backup script you will depend on. – Zoredache Aug 17 '11 at 16:33
  • This is just so I can get a dump of a database to work with locally. Nothing important. – Chad Johnson Aug 17 '11 at 16:37
  • Useful when trying to dump an invalid view getting the error `references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)`. Adding `--force` output the error but goes forward. – Antonio Bardazzi Nov 08 '16 at 08:54
1

AFIAK, you can't. You need enough privileges to run mysqldump. Why didn't you give execute privilege to the user that running?

quanta
  • 51,413
  • 19
  • 159
  • 217