mysqldump extracting data without table structure

judda picture judda · Aug 25, 2012 · Viewed 30k times · Source

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).

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.

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

Thanks

Answer

eggyal picture eggyal · Aug 25, 2012

Use the --no-create-info option, or its shorthand -t:

  • --no-create-info, -t

    Do not write CREATE TABLE statements that re-create each dumped table.

    Note

    This option does not not exclude statements creating log file groups or tablespaces from mysqldump output; however, you can use the --no-tablespaces option for this purpose.