Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

53.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;			
		
		

53.2.1. 删除数据库

			
dropdb mydb			
			
			

			
DROP DATABASE mydb