从--all-databases转储导入单个数据库 [英] Import single database from --all-databases dump

查看:507
本文介绍了从--all-databases转储导入单个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从--all-databases mysqldump导入单个数据库?我想我可以手动修改文件,但想知道是否有任何命令行选项来做到这一点。

Is it possible to import a single database from an --all-databases mysqldump? I guess I can modify the file manually but wondering if there are any command line options to do this.

我正在移动服务器,有很多数据库,我现在不需要或想要,但如果需要,可以选择恢复一个。

I am moving servers and have a lot of databases, most of which I don't currently need or want at the moment but would like to have the option to restore a single one if need be.

推荐答案

mysqldump 输出只是一组 SQL 语句。

您可以在命令行中提供所需的数据库,并使用以下命令跳过其他数据库的命令:

You can provide the desired database in the command line and skip the commands against the other databases using:

mysql -D mydatabase -o < dump.sql

这将只会执行 mydatabase 正在使用

这篇关于从--all-databases转储导入单个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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