加入收藏 | 设为首页 | 会员中心 | 我要投稿 拼字网 - 核心网 (https://www.hexinwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

PostgreSQL 选择数据库

发布时间:2022-10-18 19:03:42 所属栏目:MySql教程 来源:互联网
导读: PostgreSQL 选择数据库
上一章节我们讲了如何创建数据库,接下来我们来讨论如何去选择我们创建的数据库。
数据库的命令窗口
PostgreSQL 命令窗口中,我们可以命令提示符后面输入 SQL 语句:

PostgreSQL 选择数据库

上一章节我们讲了如何创建数据库,接下来我们来讨论如何去选择我们创建的数据库。

数据库的命令窗口

PostgreSQL 命令窗口中,我们可以命令提示符后面输入 SQL 语句:

postgres=#

使用 \l 用于查看已经存在的数据库:

postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges   
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     | 

 runoobdb  | postgres | UTF8     | C       | C     | 
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
(4 rows)

接下来我们可以使用 \c + 数据库名 来进入数据库:

postgres=# \c runoobdb
You are now connected to database "runoobdb" as user "postgres".
runoobdb=# 

系统命令行窗口

在系统的命令行查看MySQL 选择数据库,我么可以在连接数据库后面添加数据库名来选择数据库:

$ psql -h localhost -p 5432 -U postgres runoobdb
Password for user postgres: ****
psql (11.3)
Type "help" for help.
You are now connected to database "runoobdb" as user "postgres".
runoobdb=# 

pgAdmin 工具

pgAdmin 工具更简单了,直接点击数据库选择就好了,还可以查看一些数据库额外的信息:

MySQL 选择数据库_mysql库密码_mysql ip地址库

(编辑:拼字网 - 核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!