Skip or ignore definers in Mysqldump

Emilio Nicolás picture Emilio Nicolás · Aug 10, 2012 · Viewed 8.2k times · Source

I was wondering if I can prevent mysqldump inserting this commands

/*!50017 DEFINER=`root`@`localhost`*/

Or if I have to do it afterwards with sed, for example

Thanks!

Answer

NickJ picture NickJ · Oct 21, 2013

This issue has been around since 2006 with no sign of ever being fixed.

I have, however, piped it through grep (linux only) to trim out the definer lines before writing the dump file:

mysqldump -u dbuser -p dbname | grep -v 'SQL SECURITY DEFINER' > dump.sql

A bit of a mouthful (or keyboardful?) but I think it's the only way.