mysqldump data only mysqldump data only mysql mysql

mysqldump data only


mysqldump --no-create-info ...

Also you may use:

  • --skip-triggers: if you are using triggers
  • --no-create-db: if you are using --databases ... option
  • --compact: if you want to get rid of extra comments


This should work:

# To export to file (data only)mysqldump -u [user] -p[pass] --no-create-info mydb > mydb.sql# To export to file (structure only)mysqldump -u [user] -p[pass] --no-data mydb > mydb.sql# To import to databasemysql -u [user] -p[pass] mydb < mydb.sql

NOTE: there's no space between -p & [pass]


 >> man -k  mysqldump [enter in the terminal]

you will find the below explanation

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

--no-data, -d

Do not write any table row information (that is, do not dump table contents). This is useful if you want to dump only the CREATE TABLE statement for the table (for example, to create an empty copy of the table by loading the dump file).

# To export to file (data only)mysqldump -t -u [user] -p[pass] -t mydb > mydb_data.sql# To export to file (structure only)mysqldump -d -u [user] -p[pass] -d mydb > mydb_structure.sql