如何将PG转储从测试服务器带到我的PC
我正在尝试将PG转储从测试服务器带到本地计算机,我已登录到服务器
root@myProject stiging-development1:〜/myproject/current#
我应该在这里写下哪个命令,以将PG转储到我的本地机器?
I am trying to take pg dump from testing server to my local machine, i have been logged into my server
root@myproject-staging-development1:~/myproject/current#
Which command should i write in here to get pg dump into my local machine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转储您的 PostgreSQL 数据库
第 1 步 通过
SSH 连接到临时/生产服务器。
步骤 2
转储所需的数据库:
您可以根据需要命名转储 - 我使用日期来区分多个转储。
步骤 3
离开 SSH 并使用 SCP 下载新的 SQL 文件。
此命令使用 SSH 将您登录到远程服务器,并将给定文件下载到您指定的本地目录。如果您没有提供本地目录的路径,转储将保存在您当前的工作目录中。
示例:
恢复您的 PostgreSQL 转储
步骤 1
如果您想使用当前的本地主机数据库,则必须先删除它:
步骤 2
在本地主机上创建一个新数据库:
步骤 3
将转储写入数据库:
来源
Dump Your PostgreSQL Database
Step 1
SSH to the staging/production server.
Step 2
Dump the desired database:
You can name your dump as you wish - I'm using dates to distinguish multiple dumps.
Step 3
Leave SSH and download your new SQL file using SCP.
This command logs you into your remote server using SSH and downloads a given file to the local directory specified by you. If you give no path to the local directory, the dump will be saved in your current working dir.
Example:
Restore Your PostgreSQL Dump
Step 1
If you want to use the current localhost database, you must drop it first:
Step 2
Create a new database on the localhost:
Step 3
And write your dump into the database:
Source
您可以通过
ssh
命令运行pg_dump
,因此您有一个单位:You can run the
pg_dump
via thessh
command so you have a one-liner: