Phpmyadmin导出没有DATABASE_NAME或ALGORITHM的VIEW [英] Phpmyadmin export VIEW without DATABASE_NAME or ALGORITHM

查看:97
本文介绍了Phpmyadmin导出没有DATABASE_NAME或ALGORITHM的VIEW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用phpmyadmin导出sql转储时,它会创建VIEW表,如下所示:

When exporting a sql dump with phpmyadmin it creates the VIEW table like this:

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER 
VIEW `database`.`table` etc..

每次,我必须手动编辑sql转储以删除root用户和database名称.

Each time I have to manually edit the sql dump to remove the root user and database name.

推荐答案

也许我听不懂...但这一直对我有用.没有对数据库名称的引用,所有定义器都被清除掉,因此从它生成的文件中恢复非常容易:

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

要还原:

mysql -uUSERNAME -pPASSWORD database < backup.sql

只要您要还原的数据库存在(是否为空),就可以像超级按钮一样工作.

As long as the database you're restoring to exists (empty or not), works like a charm.

这篇关于Phpmyadmin导出没有DATABASE_NAME或ALGORITHM的VIEW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆