多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 创建数据库 语法: ``` createdb [option...] [dbname [description]] ``` example: ``` CREATE DATABASE dbname; ``` ## 查看数据库 命令行 ``` postgres=# \l 名称 | 拥有者 | 字元编码 | 校对规则 | Ctype | 存取权限 -----------+----------+----------+--------------------------------+--------------------------------+----------------------- dd | postgres | UTF8 | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | demo | postgres | UTF8 | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | hello | postgres | UTF8 | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | postgres | postgres | UTF8 | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | template0 | postgres | UTF8 | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | Chinese (Simplified)_China.936 | Chinese (Simplified)_China.936 | =c/postgres + | | | | | postgres=CTc/postgres ``` sql ``` > SELECT datname FROM pg_database; datname ----------- postgres demo template1 template0 hello dd ``` ## 进入 数据库 ``` postgres=# \c runoobdb ``` ## 删除数据库 语法 ``` DROP DATABASE [ IF EXISTS ] name ``` example ``` DROP DATABASE runoobdb; ```