When exporting a sql dump with phpmyadmin it creates the VIEW table like this:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER
VIEW `
In linux it's very simple to remove unwanted informations in a text file. Given that CREATE VIEW
creates something like:
CREATE ALGORITHM=UNDEFINED DEFINER=
USER
@HOST
SQL SECURITY DEFINER VIEWVIEWNAME
...etc.
You can use the following sed:
sed -e 's/ALGORITHM.*DEFINER VIEW/VIEW/' backup-mysqldump.sql > backup.sql
You can also using with mysqldump
in a single command, with a pipe:
mysqldump -uUSERNAME -pPASSWORD database |sed -e 's/ALGORITHM.*DEFINER VIEW/VIEW/' > backup.sql