本文介绍了将mysql数据库从远程服务器复制到本地计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用VPN,并且无法通过SSH访问远程服务器.
I'm under VPN and I don't have SSH access to remote server.
我可以通过控制台连接到远程数据库
I can connect to remote database by console
mysql -u username -p -h remote.site.com
现在我正在尝试将远程数据库克隆到本地计算机
Now I'm trying to clone the remote database to local computer
mysqldump -u username -p -h remote.site.com mysqldump | mysql -u root -ppassword webstuff
我有错误
mysqldump: Got error: 1045: Access denied for user 'webstaff'@'10.75.1.2'
(using password: YES) when trying to connect
如何将mysql数据库从远程服务器复制到本地计算机?
How to copy mysql database from remote server to local computer?
推荐答案
假定以下命令成功运行:
Assuming the following command works successfully:
mysql -u username -p -h remote.site.com
mysqldump
的语法相同,并将数据库转储输出到stdout
.将输出重定向到计算机上的本地文件:
The syntax for mysqldump
is identical, and outputs the database dump to stdout
. Redirect the output to a local file on the computer:
mysqldump -u username -p -h remote.site.com DBNAME > backup.sql
用要下载到计算机上的数据库的名称替换DBNAME
.
Replace DBNAME
with the name of the database you'd like to download to your computer.
这篇关于将mysql数据库从远程服务器复制到本地计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!