Search Posts on Binpipe Blog

Mysqldump: Structure Only , Data Only , With Views

For a normal Mysqldump we use the following snippet:

mysqldump -h hostname -u root -pmypassword databasename > dumpfile.sql


For a database dump with 'Views' we use the following:

mysqldump --routines -h hostname -u root -pmypassword databasename > dumpfile.sql

For a dump with Structure Only we use this:

mysqldump -d -h hostname -u root -pmypassword databasename > dumpfile.sql

For a list of INSERT statements (i.e data only) apply this:

 mysqldump  --skip-triggers --compact --no-create-info -h hostname -u root -pmypassword databasename > dumpfile.sql

Note:
–no-create-info skips dumping the create table and view parts for me. Just good plain data:
mysqldump –no-create-info –extended-insert=FALSE
–compact -uUSER -pPASS DBSchema > insert_data.sql
Option –extended-insert=FALSE disable multi value inserts, which results in single value inserts. Each row has it’s own insert statement.

No comments:

Post a Comment

Hi, Leave a comment here and one of the binary piper's will reply soon :)