欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

psql连接数据库

程序员文章站 2024-03-21 11:56:58
...

psql连接数据库

指定用户连接数据库

psql -d '数据库名'-U '用户名'
psql -d lawa -U odoo

查看当前连接情况

lawa=# \c
You are now connected to database "lawa" as user "odoo".
lawa=# 

已经进入到psql的情况

\c '数据库' '用户名'
lawa=# \c lawa lawa
You are now connected to database "lawa" as user "lawa".
lawa=# \c
You are now connected to database "lawa" as user "lawa".
lawa=#