Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 知乎專欄 | 視頻教程 | About

2.2. Database

$ sudo -u postgres createuser -W dbuser
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
Password:

$ sudo -u postgres createdb testdb -O dbuser
		

新建資料庫

CREATE DATABASE woodart
  WITH ENCODING='UTF8'
       OWNER=woodart;
		
CREATE DATABASE mydb ENCODING 'UTF8' TEMPLATE template0 OWNER dbuser TABLESPACE myspace;
		

2.2.1. 刪除資料庫

dropdb mydb
			

DROP DATABASE mydb