Take and Restore Mysql backup from localmachine to a remote machine

Use the below command to take the the mysql backup from the local machine and restore the same backup to the remote machine using a single command :

mysqldump -u user_name -ppassword db_name| mysql -u username -ppassword --host=host_IP -C db_name

Enjoy 🙂

ps : To take the full backup

mysqldump -u user -ppassword --all-databases > /root/databases.sql
Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s