MySQL mysqldump提取没有表结构的数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12122772/
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 14:37:36  来源:igfitidea点击:

mysqldump extracting data without table structure

mysqlmysqldumpdatabase-backups

提问by judda

I'm trying to dump all of my mysql data for one database into a single file. That said, I don't want to include the table structures in this file (there is another file which will have the structure of the tables in it).

我正在尝试将一个数据库的所有 mysql 数据转储到一个文件中。也就是说,我不想在这个文件中包含表结构(还有另一个文件,其中包含表的结构)。

Is it possible to strictly extract the data and not the table structures?

是否可以严格提取数据而不是表结构?

What I am doing right now ...

我现在在做什么...

# Extracts the database structure
mysqldump -d -hlocalhost -uusername -ppassword database -r database.sql

# Extracts each table and their data individually
mysqldump -d -hlocalhost -uusername -ppassword database --tab .

The first command will spit out a .sql file with the structure of all entities in the database whereas the second one automatically makes the .sql and .txt files with the structure and entities split out.

第一个命令将吐出一个 .sql 文件,其中包含数据库中所有实体的结构,而第二个命令会自动生成具有结构和实体的 .sql 和 .txt 文件。

What I need is one copy of the entire database which is done the same way.

我需要的是整个数据库的一个副本,它以相同的方式完成。

Thanks

谢谢

回答by eggyal

Use the --no-create-infooption, or its shorthand -t:

使用该--no-create-info选项或其简写-t