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.