Changes between Version 12 and Version 13 of jazz/PostgreSQL


Ignore:
Timestamp:
Apr 10, 2018, 4:08:00 PM (6 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/PostgreSQL

    v12 v13  
    1818}}}
    1919
    20 == 新增使用者為管理者 ==
     20=== 新增使用者為管理者 ===
    2121
    2222{{{
     
    7474* [https://stackoverflow.com/questions/8288823/query-a-parameter-postgresql-conf-setting-like-max-connections 參考]
    7575
    76 
    77 
    78 == 資料庫 ==
    79 
    80 === 資料庫列表 ===
    81 
    82 {{{
    83 ~$ sudo su - postgres
    84 ~$ psql
    85 postgres=# \l
    86                                   List of databases
    87    Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
    88 -----------+----------+----------+-------------+-------------+-----------------------
    89  postgres  | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 |
    90  template0 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres          +
    91            |          |          |             |             | postgres=CTc/postgres
    92  template1 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres          +
    93            |          |          |             |             | postgres=CTc/postgres
    94 (3 rows)
    95 
    96 }}}
    97 
    98 == 新增資料庫 ==
    99 
    100 {{{
    101 ~$ sudo su - postgres
    102 -bash-4.2$ createdb 資料庫名稱
    103 }}}
    104 
    105 == 允許使用者可以管理指定資料庫 ==
    106 
    107 {{{
    108 ~$ sudo su - postgres
    109 -bash-4.2$ psql -d postgres ### 使用 postgres 資料庫
    110 postgres=# ALTER USER 使用者名稱 WITH ENCRYPTED PASSWORD '密碼';
    111 postgres=# GRANT ALL PRIVILEDGES ON DATABASE 資料庫名稱 TO 使用者名稱;
    112 }}}
    113 
    114 == 效能調校 ==
     76=== 效能調校 ===
    11577
    11678* https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
     
    237199}}}
    238200
    239 == 資料庫備份 ==
     201
     202== 資料庫 ==
     203
     204=== 資料庫列表 ===
     205
     206{{{
     207~$ sudo su - postgres
     208~$ psql
     209postgres=# \l
     210                                  List of databases
     211   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
     212-----------+----------+----------+-------------+-------------+-----------------------
     213 postgres  | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 |
     214 template0 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres          +
     215           |          |          |             |             | postgres=CTc/postgres
     216 template1 | postgres | UTF8     | zh_TW.UTF-8 | zh_TW.UTF-8 | =c/postgres          +
     217           |          |          |             |             | postgres=CTc/postgres
     218(3 rows)
     219
     220}}}
     221
     222== 新增資料庫 ==
     223
     224{{{
     225~$ sudo su - postgres
     226-bash-4.2$ createdb 資料庫名稱
     227}}}
     228
     229== 允許使用者可以管理指定資料庫 ==
     230
     231{{{
     232~$ sudo su - postgres
     233-bash-4.2$ psql -d postgres ### 使用 postgres 資料庫
     234postgres=# ALTER USER 使用者名稱 WITH ENCRYPTED PASSWORD '密碼';
     235postgres=# GRANT ALL PRIVILEDGES ON DATABASE 資料庫名稱 TO 使用者名稱;
     236}}}
     237
     238=== 資料庫備份 ===
    240239
    241240* 一般慣用 `pg_dump` 來進行備份