简体   繁体   English

MYSQl从巨大文件中转储单个表

[英]MYSQl dump single table from huge file

如何将单个表数据从巨大的转储文件中转储到数据库中。

If I understand your question correctly - you already have a dump file of many tables and you only need the restore one table (right?). 如果我正确理解您的问题-您已经有一个包含多个表的转储文件,则只需要还原一个表(对吗?)。

I think the only way to do that is to actually restore the whole file into a new DB, then copy the data from the new DB to the existing one, OR dump only the table you just restored from the new DB using: 我认为这样做的唯一方法是将整个文件实际还原到新数据库中,然后将数据从新数据库复制到现有数据库中,或者仅使用以下方法转储刚从新数据库还原的表:

mysqldump -u username -p db_name table_name > dump.sql

And restore it again wherever you need it. 并在需要时再次还原它。

To make things a little quicker and save some disk, you can kill the first restore operation after the desired table was completely restored, so I hope the table name begins with one of the first letters of the alphabet :) 为了使操作更快一点并节省一些磁盘,可以在完全还原所需的表之后取消第一个还原操作,因此我希望表名以字母的第一个字母开头:)

There are some suggestions on how you might do this in the following articles: 在以下文章中,有一些关于如何执行此操作的建议:

I found these by searching for "load single table from mysql database dump" on Google: http://www.google.com/search?q=load+single+table+from+mysql=database+dump 我是通过在Google上搜索“从mysql数据库转储加载单个表”找到这些的: http : //www.google.com/search? q=load+single+table+from+mysql=database+dump

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM