I am looking for the syntax for dumping all data in my mysql database. I don\'t want any table information.
Best to dump to a compressed file
mysqldump --no-create-info -u username -hhostname -p dbname | gzip > /backupsql.gz
and to restore using pv apt-get install pv
to monitor progress
pv backupsql.gz | gunzip | mysql -uusername -hhostip -p dbname
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 commentsIf you just want the INSERT queries, use the following:
mysqldump --skip-triggers --compact --no-create-info
Just dump the data in delimited-text format.
When attempting to export data using the accepted answer I got an error:
ERROR 1235 (42000) at line 3367: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
As mentioned above:
mysqldump --no-create-info
Will export the data but it will also export the create trigger statements. If like me your outputting database structure (which also includes triggers) with one command and then using the above command to get the data you should also use '--skip-triggers'.
So if you want JUST the data:
mysqldump --no-create-info --skip-triggers
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]