Tuesday, November 13, 2007

Mysql - copy table from one database to other

Hi friends

This article explains how to move the particular table from the database to other database of same machine or different machine.Obviously, the user should have sufficient access for the database.

Copy the Table

Syntax:
# mysqldump --opt databasename table1 table2 tablen > tableexport.sql

For eg.,
# mysqldump --opt projectdbname tablename > anybackupname.sql

Moving to Remote machine using SCP:

# scp anybackupname.sql root@remotename_or_ip:/tmp

Restore

# mysql resultantdbname < anybackupname.sql

Thanks
Logu
logu_microsoft@hotmail.com
91-98414-99143

No comments: