Sunday, July 16, 2006

Copy MySQL tables between different hosts [31]

The following command will allow you to copy MySQL tables between different hosts


mysqldump -h ip -uuser -ppass from_db from_table | mysql -uuser -ppass target_db

2 comments:

Tyler said...

Be careful specifying your password on the command line like that. Other users might be able to view it at /proc/[mysqldump pid]/cmdline

Anonymous said...

I thought this was a neat one until I tried it, and found it less problematic to just make a dump file and import it.