Knowledge Base

January 23, 2008

Take the dump of database from the console

Filed under: Technical — Tags: , , — rkutti @ 8:09 am

To take dump of whole database:
$ mysqldump -u <username> -p <databasename> > <filename>.sql

To take dump of the (only)structure of the database
$ mysqldump -u <username> -p <databasename> -d > <filename>.sql

To take dump of the (only)data of the database
$ mysqldump -u <username> -p <databasename> -t > <filename>.sql

To take dump of the database with complete insert statement
$ mysqldump -u <username> -p <databasename> -c > <filename>.sql

2 Comments »

  1. [...] Original de | Knowledge Base Tambien te puede [...]

    Pingback by Ubuntu Life » Blog Archive » [Tip] Consola: Realizar un volcado de MySQL — January 23, 2008 @ 2:24 pm

  2. We can combine these two in one:
    To take dump of the (only)data of the database
    $ mysqldump -u -p -t > .sql

    To take dump of the database with complete insert statement
    $ mysqldump -u -p -c > .sql

    $ mysqldump -u -p -t -c > .sql

    Comment by Sanjay — January 25, 2008 @ 10:09 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.