Friday, August 22, 2014

mysqldump warning skipping mysql.event table data

If you don't want to give your "backup" user Super permissions and you don't use events you'll be stuck with an annoying warning:

-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.

Every time you run a scheduled backup of your mysql database.  You still want those cronjob emails with any database backup errors but you don't want that one.  This might help you:

mysqldump --routines -u$USER -p$PASS -h$HOST -r$DIR/$FILE $DB 2>&1 | grep -v 'Skipping the data of table mysql.event' 1>&2

What it does is redirects all errors from mysqldump to STDIN.  It then greps out the event error and redirects any other errors back to STDERR.

The key is that you MUST use the -r option  (write to a file directly to a file rather than STDOUT) with mysqldump.  If you have other warnings you don't want to see you can use:

... | grep -vE '(warning 1 substring|warning 2 substring)' 1>&2

Another option might be to use Cronic.  Good luck!

No comments:

Post a Comment