Postgrel 常见操作(1)

    xiaoxiao2025-01-02  21

    在win下用客户端,基本上不需要记录什么命令了,在linux不一样做个标记:

    显示所有数据库:

    \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+---------+-------+----------------------- postgres | postgres | UTF8 | C | C | template0 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres testdb | postgres | UTF8 | C | C | 选择数据库:

    postgres=# \c testdb; psql (9.2.4) Type "help" for help. You are now connected to database "testdb" as user "postgres". testdb=#

    删除数据库

    DROP DATABASE [ IF EXISTS ] name

    Example

    Following is a simple example, which will delete testdb from your PostgreSQL schema:

    postgres=# DROP DATABASE testdb; postgres-#
    转载请注明原文地址: https://ju.6miu.com/read-1295164.html
    最新回复(0)