You are on page 1of 4

Steps to copy one database from one desktop/laptop to another desktop/laptop

1. Suppose we have server installed and use “show databases;” command to see all the databases.

2. Now I am showing a database “library” and its tables in it.

3. See I am showing the content of “library” table.


4. Now come to command prompt and issue the following command:
mysqldump -uroot -ppankaj library > d:\lib.sql <enter>

here mysqldump is command


-uroot means user is root
-pankaj means password is pankaj <if you have not given password, you can skip it)
library is the name of your database
> means we want to send library database to d:
lib.sql is the name of our sql file to copy and send to other place.
5. Now I have deleted the database from this server to demonstrate you to again restore it.

6. You can see now we don’t have library database here.


7. Now we will restore it. To restore first make the database library in Server. (to restore from
lib.sql file, library database needs to already created in server.)

8. At present, this does not contain any tables and data. Now to restore, we will go to command
prompt again and issue the following command:
mysql -uroot -ppankaj library < d:\lib.sql

9. Now you can see all tables with data in that database.

That’s it . . .

Pankaj Singh
PGT(CS) – KV No 1, AFS AGRA

You might also like