我可以使用mysqldump导出所有数据库(除一个数据库以外)的转储吗? [英] Can I get a dump of all my databases *except one* using mysqldump?

查看:192
本文介绍了我可以使用mysqldump导出所有数据库(除一个数据库以外)的转储吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用mySQLdump备份我的开发机和服务器.

I'm currently using mySQLdump to backup my dev machine and servers.

但是我刚开始的一个项目中,有一个我确实不需要备份的HUUUUUGE数据库,将其添加到其余备份周期将是一个大问题.

There is one project I just started, however, that has a HUUUUUGE database that I don't really need backed up, and i'll be a big problem to add it to the rest of the backup cycle.

我目前正在这样做:

"c:\Program Files\mysql\MySQL Server 5.1\bin\mysqldump" -u root -pxxxxxx --all-databases > g:\backups\MySQL\mysqlbackup.sql

是否可以通过某种方式指定此数据库除外"?

Is it possible to somehow specify "except this database(s)"?

我不想手动指定数据库列表,因为那意味着我每次创建新数据库时都必须记住更新备份批处理文件,而且我知道这不会发生.

I wouldn't like to have to specify the list of DBs manually, since that would mean that I'd have to remember updating my backup batch file every time I create a new DB, and I know that's not gonna happen.

正如您可能从上面的命令行中猜到的那样,我在Windows上执行此操作,因此我无法执行任何类型的高级bash任务,只能执行弱小的.bat任务.

As you probably guessed from my command line above, i'm doing this on Windows, so I can't do any kind of fancy bash stuff, only wimpy .bat things.

或者,如果您有其他想法可以解决同一问题,那么当然欢迎他们!

Alternatively, if you have other ideas to solve this same issue, they are more than welcome, of course!

推荐答案

mysql ... -N -e "show databases like '%';" | grep -v -F databaseidontwant | xargs mysqldump ... --databases > out.sql

这篇关于我可以使用mysqldump导出所有数据库(除一个数据库以外)的转储吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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