简体   繁体   English

如何从文件连接到postgresql?

[英]How to connect to postgresql from files?

Ok, so I have a client who has a postgresql database. 好的,所以我有一个拥有Postgresql数据库的客户。 He sent me the files (they look like this: http://prntscr.com/fbyz2l ). 他向我发送了文件(它们看起来像: http : //prntscr.com/fbyz2l )。

I have PGAdmin 4 on my windows 10 box. 我的Windows 10机器上装有PGAdmin 4。 I also have postgres installed locally. 我也在本地安装了postgres。

I have the database name and login information... but I can't figure out how to connect to the database. 我有数据库名称和登录信息...但是我不知道如何连接到数据库。

I am guessing it is pretty simple, but I am having a tough time googling the right thing to get some help. 我猜这很简单,但是我很难找到合适的东西来寻求帮助。

Update 更新

I am still hunting this, but my feeling is the files are not the right format to import or bring onto my localhost. 我仍在寻找,但是我的感觉是文件不是导入或导入我的本地主机的正确格式。 I am asking for a backup file that PGAdmin can make. 我要求PGAdmin可以制作一个备份文件。 If anyone has input on this, I am all ears. 如果有人对此表示投入,我会非常高兴。

Update 2 更新2

So I copied all the files to C:\\Program Files\\PostgreSQL\\data\\pg96\\base 所以我将所有文件复制到C:\\ Program Files \\ PostgreSQL \\ data \\ pg96 \\ base

Restarted the server. 重新启动服务器。 When I do a 当我做一个

   psql -h "C:\Program Files\PostgreSQL\data\pg96\base" -l

I get this: 我得到这个:

http://prntscr.com/fbzxf2 http://prntscr.com/fbzxf2

I can connect to template1 and postgres, but neither of them is my database (184429). 我可以连接到template1和postgres,但它们都不是我的数据库(184429)。 Ugh... 啊...

Thanks! 谢谢!

These files are basically copy of the postgres DB . 这些文件基本上是postgres DB的副本。 You need to restore it on your machine . 您需要在计算机上还原它。 You can find default path of postgres DB on C:\\Program Files\\PostgreSQL\\some version\\data location . 您可以在C:\\Program Files\\PostgreSQL\\some version\\data location上找到postgres DB的默认路径。 Place the root of these files within that directory and restart your postgres service . 将这些文件的根目录放在该目录中,然后重新启动postgres服务。

After that you can find new database in your PGAdmin . 之后,您可以在PGAdmin中找到新的数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM