建立一个新连接

最近更新时间: 2025-02-18 16:02:00

  • 连接到另外一个库(也可以是当前库)。
  • 复制
    复制成功
 postgres=# select pg_backend_pid();
 pg_backend_pid 
----------------
          2408
(1 row)
 postgres=# \c
You are now connected to database"postgres" as user "tbase".
 postgres=# select pg_backend_pid();
 pg_backend_pid 
----------------
          2426
(1 row)
 postgres=# \c template1
You are now connected to database"template1" as user "tbase".
template1=#
  • 连接到外一台服务。
  • 复制
    复制成功
postgres=# \c postgres tbase 172.16.0.4715432
You are now connected to database"postgres" as user "tbase" on host "172.16.0.47"at port "15432".