When exporting a sql dump with phpmyadmin it creates the VIEW table like this:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER
VIEW `
Maybe I'm not understanding... but this has always worked for me. There are no references to the database name and all definers get wiped out so it's super-easy to restore from the file it generates:
mysqldump -uUSERNAME -pPASSWORD database | sed -e 's/DEFINER=[^*]*\*/\*/' > backup.sql
To restore:
mysql -uUSERNAME -pPASSWORD database < backup.sql
As long as the database you're restoring to exists (empty or not), works like a charm.