如何只从 MySQL 转储特定的表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2987366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 16:12:55 来源:igfitidea点击:
How to dump only specific tables from MySQL?
提问by Harish Kurup
If my database has 10 tables and I want to dump only 3 tables. Is it possible with mysqldump
command?
如果我的数据库有 10 个表,而我只想转储 3 个表。是否有可能与mysqldump
命令?
回答by Lauri Lehtinen
Usage: mysqldump [OPTIONS] database [tables]
i.e.
IE
mysqldump -u username -p db_name table1_name table2_name table3_name > dump.sql
回答by Raja Bose
If you're in local machine then use this command
如果您在本地机器上,则使用此命令
/usr/local/mysql/bin/mysqldump -h127.0.0.1 --port = 3306 -u [username] -p [password] --databases [db_name] --tables [tablename] > /to/path/tablename.sql;
For remote machine, use below one
对于远程机器,请使用以下之一
/usr/local/mysql/bin/mysqldump -h [remoteip] --port = 3306 -u [username] -p [password] --databases [db_name] --tables [tablename] > /to/path/tablename.sql;