I am looking for the syntax for dumping all data in my mysql database. I don't want any table information.
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.
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.
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.
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 commentsThis 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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With