Copy database to another database through command

1. Copy One database to other on same host

mysqldump -uroot -p source_database_name | mysql -uroot dest_database_name

2. Copy database from one host to other host.

mysqldump -uroot -p source_database | ssh host2 “mysql -uroot dest_database”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.