Pages

Monday, June 28, 2010

Backup and Restore MySQL Database

Being an open source player, every one will be familiar with the DB called MYSQL. But every time we start becoming closer to have a move with the DB, we need to know also "How we can take BackUp the DB and Restore Back." I mean when i started every-time with my new project, i face difficult in backing up the Whole  DB, Particular DB, Sometime backing up the specific Table of the DB. We can do easy and handy if we have PHPMYADMIN Panel. But some time while working with the remote server we won't have this PANEL..So How shall we do it..  After  some goggling i got the stuff.. I have explain below:-


BACKING UP
1. Particular Database:-
mysqldump -u xxx -p xxx DB-Name  > /path for storage/new backup name;
mysqldump -u root -p xxx dbname > /home/administrator/dump/demodummy.sql;


2. Particular Table:-
mysqldump -u xxx -p xxx DB-Name Table-Name > /path for storage/new backup name;
mysqldump -u root -p xxx dbname studentdetails> /home/administrator/dump/demodummy2.sql;


Note: Make sure  while taking the dump, we should not be inside the mysql. We need to be in shell.


Restoring UP 

1. Particular Database:-
mysql -u xxx -p xxx  DB-Name < /source path of the file/demodummy.sql;
mysql -u xxx -p xxx  dbname < /home/administrator/dump/demodummy.sql;


2. Particular Database:-
mysql -u xxx -p xxx  DB-Name < /source path of the file/demodummy.sql;
mysql -u xxx -p xxx  dbname < /home/administrator/dump/demodummy2.sql;


Note: before we restore we need to create a database.


If you want to read more Go Here






No comments:

Post a Comment