“使用数据库名称” PostgreSQL中的命令

编程入门 行业动态 更新时间:2024-10-22 09:46:36
本文介绍了“使用数据库名称” PostgreSQL中的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是PostgreSQL的初学者。

I am beginner to PostgreSQL.

我想从Postgres的查询编辑器连接到另一个数据库,例如 USE 命令。

I want to connect to another database from the query editor of Postgres - like the USE command of MySQL or MS SQL Server.

我通过搜索Internet找到了 \c数据库名称,但是它只能在 psql 。当我从PostgreSQL查询编辑器尝试它时,出现语法错误。

I found \c databasename by searching the Internet, but its runs only on psql. When I try it from the PostgreSQL query editor I get a syntax error.

我必须通过pgscripting更改数据库。有人知道怎么做吗?

I have to change the database by pgscripting. Does anyone know how to do it?

推荐答案

当您与 PostgreSQL 总是到特定的数据库。要访问其他数据库,必须获得新的连接。

When you get a connection to PostgreSQL it is always to a particular database. To access a different database, you must get a new connection.

在psql中使用 \c 关闭旧的数据库连接并使用指定的数据库和/或凭据获取新的连接。您将获得一个全新的后端流程以及所有内容。

Using \c in psql closes the old connection and acquires a new one, using the specified database and/or credentials. You get a whole new back-end process and everything.

更多推荐

“使用数据库名称” PostgreSQL中的命令

本文发布于:2023-10-18 11:07:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504061.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令   名称   数据库   PostgreSQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!