mysqldump备份并还原到远程服务器

问题描述:

如何使用mysqldump备份数据库并将其还原到远程服务器?

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

两者都具有root访问权限.我正在用腻子来执行此操作.

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

到目前为止,我尝试了以下操作:

So far I tried the following:

mysqldump -u root -p >z*x311a!@ masdagn_joom15 | mysql \ -u root -p g2154hE6-AsXP --host=207.210.71.26 -C masdagn_joom15temp \g

但它拒绝了

本地密码为:> z * x311a!@

the local password is: >z*x311a!@

远程密码为:g2154hE6-AsXP

the remote password is: g2154hE6-AsXP

This link provides information on backing up and restoring with mysqldump. It also gives some examples with a remote server.

该链接中的重要命令是:

The important commands from that link being:

备份:

mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

还原:

mysql -u root -p[root_password] [database_name] < dumpfilename.sql