您现在的位置是:课程教程文章

postgresql如何更换用户登录

2023-12-18 20:16课程教程文章 人已围观

使用psql怎么切换数据库或者用户呢?

通过如下方式可以通过特定用户连接特定数据库:

[highgo@rhel ~]$ psql -d highgo -U highgo

-d就是指定的数据库名,-U就是指定的用户名。

如果通过psql已经连接进来了,我们可以怎么切换呢?

通过如下方式:

highgo=# \c highgo xyh
Password for user xyh:
You are now connected to database "highgo" as user "xyh".
highgo=>

通过\c,后跟数据库和用户名。

\c后什么都不写会显示当前连接信息:

highgo=> \c
You are now connected to database "highgo" as user "xyh"

推荐学习《Python教程》。

课程教程:postgresql如何更换用户登录

上一篇:怎么强制停止jupyter

下一篇:没有了

站点信息

  • 文章统计篇文章