• 技术文章 >数据库 >PostgreSQL

    PostgreSQL怎么切换数据库

    月亮邮递员月亮邮递员2020-03-28 14:00:47原创7120

    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教程

    专题推荐:postgresql 切换 数据库
    品易云
    上一篇:PostgreSQL怎么提前缓存数据 下一篇:PostgreSQL怎么还原数据库?

    相关文章推荐

    • PostgreSQL怎么延时执行• PostgreSQL怎么提前缓存数据

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网