PostgreSQL怎么切换数据库

908次阅读
没有评论

PostgreSQL怎么切换数据库

PostgreSQL怎么切换数据库

PostgreSQL切换数据库使用\c命令。

命令格式:

切换数据库:\c [database_name]

切换用户:\c – [user_name]

1、先连上用户postgres、数据库postgres

$ su - postgres
Last login: Wed Mar 1 13:16:48 CST 2017 on pts/1
-bash-4.2$ psql
psql (9.2.18)
Type "help" for help.
postgres=#

2、切换数据库

postgres=# \c zzj_db;
You are now connected to database "zzj_db" as user "postgres".
zzj_db=#

3、切换用户

zzj_db=# \c - zzj_user;
Password for user zzj_user:
You are now connected to database "zzj_db" as user "zzj_user".
zzj_db=>

推荐:postgresql教程

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:postgresql2022-12-02发表,共计474字。
新手QQ群:570568346,欢迎进群讨论 Python51学习