Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump data only

I am looking for the syntax for dumping all data in my mysql database. I don't want any table information.

like image 566
Lizard Avatar asked Feb 24 '11 20:02

Lizard


People also ask

Does Mysqldump include data?

Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. It produces the SQL Statements that can be used to recreate the database objects and data. The command can also be used to generate the output in the XML, delimited text, or CSV format.

How do I export just one row in MySQL?

If you want to export only certain rows from a MySQL database using mysqldump , you can select the records using the --where option. It dumps only rows selected by the given WHERE condition. Quotes around the condition are mandatory if it contains spaces or other characters that are special to your command interpreter.

Can I restore a single table from a full MySQL Mysqldump file?

Use the sed command on your bash shell to separate the data of the table that you want to restore. For example, if we want to restore only the “film_actor” table to “sakila” database we execute the script below.


2 Answers

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
like image 73
matei Avatar answered Sep 18 '22 03:09

matei


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 database mysql -u [user] -p[pass] mydb < mydb.sql 

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

like image 33
Ish Avatar answered Sep 19 '22 03:09

Ish