💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[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; ```