mysqldump backup and restore to remote server

前端 未结 6 682
清酒与你
清酒与你 2020-12-15 08:31

How can i use mysqldump to backup and restore database to a remote server?

Both have root access. I am using putty to perform this.

So far I tried the follo

6条回答
  •  醉梦人生
    2020-12-15 09:07

    mysqldump --user=username --password=pwd db_name | bzip2 -c > /backup_dir/db_name.sql.bz2
    

    you can embed this part in a script, afterward you can use FTP to transfer to the other location.

    To restore, you can

    bzip2 -d db_name.sql.bz2
    mysql --user=username --password=pwd db_name < db_name.sql
    

提交回复
热议问题