如何从终端从远程服务器下载mySQL表

时间:2018-08-19 04:26:28

标签: mysql ssh terminal

我通过Mac OS终端被重定向到远程MySQL服务器。我在数据库中,正在查看要下载到桌面的表。如何下载?我听说过mysqldump,但是这使我感到困惑。我对MySQL和数据库一般都是新手,因此不能冒险以某种方式弄乱该数据库。有人可以给我确切的命令下载表格吗?预先谢谢你!

1 个答案:

答案 0 :(得分:0)

如果您使用ssh登录,则意味着您有权访问shell。找到数据库文件的位置,然后使用scp下载它。

命令如下所示:

scp -P 1234 user1@mysql.server.com:/location/of/source/file /location/of/destination

-P 1234: port number 1234 (may vary in your case)
user1: username
mysql.server.com: domain
/location/of/source/file: location of the database file on the server
/location/of/destination: location where you want to save the file on your computer

您还希望确保您具有使用scp复制文件的必要权限。

下载后,您可以使用数据库浏览器签出内容。