mysqldump extracting data without table structure

33,213

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.

Share:
33,213

Related videos on Youtube

judda
Author by

judda

Currently a .NET developer who is constantly looking for open source projects to help out on.

Updated on August 26, 2020

Comments

  • judda
    judda over 3 years

    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

  • judda
    judda over 11 years
    Perfect! Thank you very much!
  • phil294
    phil294 about 7 years
    this still creates triggers.