数据库管理 create database teledbmul owner teledbuser CONNECTION LIMIT 50 template template0 encoding 'utf8' lccollate 'C'; CREATE DATABASE 修改数据库配置 修改数据库名称 plaintext teledb alter database teledbdb rename to teledbdbnew; ALTER DATABASE 修改连接数 plaintext teledb alter database teledbdbnew connection limit 50; ALTER DATABASE 修改数据库所有者 plaintext teledb alter database teledbdbnew owner to teledb; ALTER DATABASE 配置数据默认searchpath plaintext teledb alter database teledbdbnew set searchpath to public, pgcatalog; ALTER DATABASE alter database不支持修改的项目 项目 备注 encoding 编码 lccollate 排序规则 lcctype 分组规则 删除数据库 plaintext 删除数据库teledbdbnew teledb drop database teledbdbnew; 仍有会话连接数据库时,会报错 ERROR: database "teledbdbnew" is being accessed by other users DETAIL: There is 1 other session using the database. 停止该数据库的所有连接,后重新删除数据库 teledb select pgterminatebackend(pid) from pgstatactivity where datname'teledbdbnew'; pgterminatebackend t (1 row) teledb drop database teledbdbnew; DROP DATABASE