When exporting a sql dump with phpmyadmin it creates the VIEW table like this:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER
VIEW `
When exporting a sql dump with phpmyadmin it creates the VIEW table like this:
I've checked with mysqldump
, which does precisely the same. Both mysqldump as PHPMyAdmin seem to execute SHOW CREATE, which results in having a security definer in the create statement. I don't see any way to "turn it off".
Each time I have to manually edit the sql dump to remove the root user and database name.
This is where I can help though. Manually editing an SQL file is hell and it's too error-prone. I've had these issues before where the exporting user didn't exist on the platform I wanted to import. The only thing I needed to edit was everything between CREATE and VIEW.
Now, since you've tagged your question with php
, I imagine you know how to use it from commandline. Here's a script that will replace all of the non-necessary values with an empty string:
Maybe not a direct answer to your question, but it should prevent you from having to manually edit the dumps.