postgresql如何更换用户登录

使用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教程》。

来源:PY学习网:原文地址:https://www.py.cn/article.html

hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » postgresql如何更换用户登录