13

In my database backups and export I get something like the following:

/*!50001 DROP TABLE `vTime`*/;
/*!50001 DROP VIEW IF EXISTS `vTime`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`db_user`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `vTime` AS select ... */;
  1. This causes problems when restoring since the "CREATE ALGORITHM" and "DEFINER" parts fail when trying to restore. Is there a way to make mysqldump just do a simple CREATE VIEW instead?

  2. Bonus question: what do the /*!50001 parts mean?

EDIT: I should add that this is the error I'm getting:

#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation

EDIT 2: It appears that only the /*!50013 DEFINER= part is failing.

Sarke
  • 2,805
  • 2
  • 18
  • 28

2 Answers2

4

The /*!50001 part is a version number.

The question was already answered here: MySQL flags in dumps

The main issue of removing the DEFINER is best done with a script. Some examples already online:

https://dbperf.wordpress.com/2010/04/12/removing-definer-from-mysql-dump/

Remove DEFINER clause from MySQL Dumps

Community
  • 1
  • 1
mba12
  • 2,702
  • 6
  • 37
  • 56
2

This sed command should work for removing both these clauses from mysqldump -

sed -e 's|^/[*]!50001 CREATE ALGORITHM=UNDEFINED [*]/|/*!50001 CREATE */|' -e '/^[/][*]!50013 DEFINER=/d'

Where 50001 and 50013 are respective versions as already mentioned above.

techiegirl123
  • 81
  • 1
  • 10