Mysql – thesqldbcopy from one server to other

MySQL

I am trying to copy one database schema from one server to other. I know how to do it in same server using mysqldbcopy but i dont know how to user it while copying from one server to other.

mysqldbcopy --source=root:''@localhost --destination=root:''@localhost Test_DB:Test_DB_Copy

This is how i copy in the same server. Please help me out in copying the schema to different server using msqldbcopy command.

Best Answer

mysqldump -h source.machine db_name  |  mysql -h target.machine

Add -u and -p as appropriate to both.

If you need to change the db name, add the suitable arg to mysqldump to avoid including DROP DATABASE and CREATE DATABASE; plus add the new db_name on the mysql command.

If you need to copy "routines", more args are needed.