如何为托管在AWS上的PostgreSQL数据库执行SQL脚本?
我正在尝试运行一个在AWS RDS上托管的数据库的SQL文件。我使用的命令是以下内容:
psql -v user=myusername -v dbname=postgres -v passwd=mypassword -f ./explorerpg.sql
运行后,我得到以下结果:
sql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
我缺少什么?对于那些好奇的人,我试图让Hyperledger Explorer显示AWS区块链的数据库内容。 SQL脚本来自Hyperledger Explorer。
任何建议都非常感谢!
I am trying to run an sql file for a database hosted on AWS RDS. The command I am using is the following:
psql -v user=myusername -v dbname=postgres -v passwd=mypassword -f ./explorerpg.sql
After running it I get the following result:
sql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
What am I missing? For those curious I am trying to get Hyperledger explorer to display the database contents of an AWS blockchain. The sql script is from Hyperledger explorer.
Any suggestions are greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少
-h
(或- 主机
)选项。您正在运行的命令正在尝试连接到Localhost上的PostgreSQL Server。此外,您正在尝试使用命令行进行努力。您想要更多类似的东西:可能不应该这样做密码 - 包含密码的文件更常见。但是,关键是要找到RDS服务器的主机名,并使用
-H
选项指定它。You're missing the
-h
(or--host
) option. The command you're running is trying to connect to a PostgreSQL server on your localhost. Additionally, you're trying too hard with the command line. You want something more like:The password likely should not be done this way - a file containing the password is more common. But the key is to find the hostname of your RDS server and specify it with the
-h
option.