wiki:jazz/PostgreSQL

Version 1 (modified by jazz, 7 years ago) (diff)

--

PostgreSQL

修改管理者密碼

~$ sudo su - postgres
~$ psql
postgres=# \password postgres
Enter new password: 
Enter it again: 
postgres=# \q

資料庫列表

~$ sudo su - postgres
~$ psql
postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | 
 template0 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)

新增使用者

~$ sudo su - postgres
-bash-4.2$ createuser 使用者名稱

新增資料庫

~$ sudo su - postgres
-bash-4.2$ createdb 資料庫名稱