如何使用PSQL创建Postgres数据库的SQL转储文件
我目前已经通过Supabase创建了一个数据库,该数据库使用Postgres数据库。这样做之后,我在计算机上下载了Postgres,这给了我PSQL命令行脚本,用于连接到Postgres数据库。
我打算通过PSQL脚本创建Supabase数据库的本地备份。 之后,我已经连接到supabase数据库之后
,我可以看到PSQL成功地连接到数据库。
然后,我尝试使用pg_dump命令来尝试创建数据库的转储文件。 这是我使用的命令:
pg_dump postgresql:// postgres:[数据库密码]@db.epvzhrganrzfwexmiksg.supabase.co:5432/postgres> 但是, dumpfile.sql
但是,在我按ENTER之后,PSQL没有运行命令,它只是移动到新的命令行。因此,我不确定是否输入了转储命令的错误,还是我需要使用的其他PSQL命令。
I currently have created a database via Supabase, which uses the Postgres database. After doing so, I then downloaded Postgres on my computer, which gave me the psql command line script for use to connect to postgres databases.
I intend to create a local backup of my Supabase database through the psql script.
This is after I have connected to the supabase database through psql
From this, i can see that psql successfully connected to the database.
I then tried to use the pg_dump command to attempt to create a dump file of the database.
This was the command I used:
pg_dump postgresql://postgres:[Database password]@db.epvzhrganrzfwexmiksg.supabase.co:5432/postgres > dumpfile.sql
However, after I pressed enter, psql did not run the command, it simply moved to a new command line. As such, I am not sure whether I inputted something wrong for the dump command or is it a different psql command I need to use for it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如前所述,您已成功与PSQL联系。
来自OS提示
psql提示
发布备份,MyDB.SQL文件可以复制&通过PSQL导入到本地机器。
As mentioned, you have successfully connected with psql.
From OS prompt
From psql prompt
Post backup done , mydb.sql file can be copied & import via psql to local machine.
如 @adrian -klaver所述,pg_dump命令应直接从终端运行,而不是从psql shell
运行
pg_dump -v
内部运行。通常安装PSQL https://stackoverflow.com/a/a/49689589/1267728as mentioned by @adrian-klaver the pg_dump command should be run directly from the terminal, and not from inside the psql shell
run
pg_dump -V
to check that it's installed. It is usually installed when you install psql https://stackoverflow.com/a/49689589/1267728