Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 尝试将Heroku数据库下载到本地:连接到数据库失败_Ruby On Rails_Postgresql_Heroku - Fatal编程技术网

Ruby on rails 尝试将Heroku数据库下载到本地:连接到数据库失败

Ruby on rails 尝试将Heroku数据库下载到本地:连接到数据库失败,ruby-on-rails,postgresql,heroku,Ruby On Rails,Postgresql,Heroku,我在下面的文档中尝试将Heroku数据库拉到本地主机。我已经成功运行了heroku pg:backups:capture和heroku pg:backups:download,并在我的文件结构中查看了一个最新的.dump文件 但是,当我尝试运行pg\U restore--verbose--clean--no acl--no owner--h localhost-U myuser-d mydb latest.dump时,我得到以下错误: pg_restore: connecting to data

我在下面的文档中尝试将Heroku数据库拉到本地主机。我已经成功运行了
heroku pg:backups:capture
heroku pg:backups:download
,并在我的文件结构中查看了一个
最新的.dump
文件

但是,当我尝试运行
pg\U 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?

有人能帮我解决这个问题吗?

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