Skip to content

PostgreSQL 管理用户和数据库

用户

创建用户

shell
createuser <username>

删除用户

shell
DROP ROLE <username>

查看所有创建的用户

shell
psql -U postgres

\du

查看用户与关联的数据库

shell
psql -U postgres

\l

数据库

创建数据库

shell
createdb <dbname>

实用命令

shell
psql -c "<sql>"

TODO...