数据库信息:
sqlshell
Server [localhost]: 192.168.30.101
Database [postgres]:
Port [5432]: 5432
Username [postgres]:
用户 postgres 的口令:
psql (15.12, 服务器 16.8 (Debian 16.8-1.pgdg120+1))
警告:psql 主版本15,服务器主版本为16.
一些psql功能可能无法正常使用.
输入 "help" 来获取帮助信息.
postgres=# \l
数据库列表
名称 | 拥有者 | 字元编码 | 校对规则 | Ctype | ICU Locale | Locale Provider | 存取权限
-----------+----------+----------+------------+------------+------------+-----------------+-----------------------
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(3 行记录) 解释以上代码
以下是对您提供的 PostgreSQL 命令行交互及输出的详细解释:
1. 连接数据库的过程
bash
Server [localhost]: 192.168.30.101 # 指定数据库服务器 IP 地址
Database [postgres]: # 使用默认数据库名 postgres(直接回车)
Port [5432]: 5432 # 使用默认端口 5432(直接回车)
Username [postgres]: # 使用默认用户名 postgres(直接回车)
用户 postgres 的口令: # 输入 postgres 用户的密码(输入时不显示)
- 通过
psql
命令连接到 PostgreSQL 服务器,手动指定了服务器 IP(192.168.30.101
),其他参数(数据库名、端口、用户名)使用默认值。 - 输入密码后成功连接,进入
psql
交互界面。
2. 版本兼容性警告
bash
psql (15.12, 服务器 16.8 (Debian 16.8-1.pgdg120+1))
警告:psql 主版本15,服务器主版本为16.
一些psql功能可能无法正常使用.
- 客户端(psq