2017-04-12 108 views
1

我正在关注this文档,试图将我的Heroku数据库拉到我的本地主机。我已成功运行heroku pg:backups:captureheroku pg:backups:download,并在我的文件结构中看到latest.dump文件。试图将Heroku数据库下载到本地:连接到数据库失败

然而,当我尝试运行pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump我得到以下错误:

pg_restore: connecting to database for restore 
pg_restore: [archiver (db)] connection to database "mydb" failed: could not connect to server: Connection refused 
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused  
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? 

谁能帮助我弄清楚如何解决这一问题?

回答

2

要在恢复期间创建mydb数据库,您需要--create选项。否则,根据错误消息,该命令会查找名为mydb的现有数据库,该数据库似乎并不存在。