Dumping a Mysql Database

16 / Apr / 2009 by gaurav 1 comments

In this post i will try to explain how to dump a mysql database so that it can be migrated with same state.In my project i face this situation every week and thanks to dumpfiles that they save lot of time and make the process whole lot easier.

What is a dumpfile ?

A dumpfile is a sql script which contains the step by step instruction to generate a database. It contains the steps to create the table structure and also populates the tables with the original values. By steps i mean the plain simple sql queries.

The Mysql command used to  dump a database is below:

gaurav@gaurav:~$ mysqldump -u root -p   >

e.g. Suppose we have a database named james and we want to take it’s dump.

gaurav@gaurav:~$ mysqldump -u root -p james > ~/Desktop/jamesDump.sql
Enter Password: ******

Now we are back to prompt. We can check the dumpfile by going to the location where it was saved. In the next post I will describe how to use a dumpfile to create a new database.

Hope it helps.


comments (1 “Dumping a Mysql Database”)

  1. SQL Tutorials

    Does anyone know if there is another language or set of commands beside SQL for talking with databases?

    I’m working on a project and am doing some research thanks


Leave a Reply

Your email address will not be published. Required fields are marked *