Thursday, January 18, 2007

restoring databases ,tables



Take a backup of the table which your looking to restore using mysqldump.
mysqldump -u<username> -p<password> <databasename> <tablename> > <path and name of the file>

ex:mysqldump -usridhar -pthajes testdb usermas > /home/sridhar/mysqldump/tablebackup.txt

where we get only usermas table backup.

for restoring to another db. use
mysql <dbname> < /home/sridhar/mysqldump/tablebackup.txt
ex: mysql restDB < /home/sridhar/mysqldump/tablebackup.txt .

Note: If restDB has already usermas table, pls drop before restoring.

No comments:

Post a Comment