Windows版PostgreSQLのインストール
環境は Win[7|10] Pro x64 試したのは postgresql-9.6.3-2-windows-x64
メモ サービスの起動 タスクバーの検索欄から services.msc を入力
基本的なインストールの手順はこちらPostgreSQLのダウンロード及びインストール
インストールを始める前にロケール(国際化と地域化)をまず読んで--locale=Cでいいのかな?と事前に確認したほうが良いのかな?と
手順に従ってイントールを進めますが、ロケールは[C]を選択します
インストール後は /path/to/pgsql\96\bin まで 環境変数のpathに登録するのが 吉かと
インストーラーで実行終了後、Linuxでソースからインストするときのどの状態になっているのかが不明でした
> psql -lU postgres
ユーザ postgres のパスワード:
データベース一覧
名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
postgres | postgres | UTF8 | C | C |
template0 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(3 行)psql -l の結果を見ると
環境変数を設定後
make install
initdb --locale=C --encoding=UTF-8
で作成した状態かなと
PostgreSQL Sample Databaseをセットしてみる。上記の下の方から dvdrental.zip をDLして解凍する。
> reatedb --locale=C --encoding=UTF-8 --template=template0 -U postgres dvdrental
でDBを作成する.
> psql -lU postgres
ユーザ postgres のパスワード:
データベース一覧
名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
dvdrental | postgres | UTF8 | C | C |
postgres | postgres | UTF8 | C | C |
template0 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(4 行)
> pg_restore -U postgres -d dvdrental dvdrental.tar
パスワード:
> psql -U postgres
ユーザ postgres のパスワード:
psql (9.6.3)
"help" でヘルプを表示します.
postgres=# \l
データベース一覧
名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
dvdrental | postgres | UTF8 | C | C |
postgres | postgres | UTF8 | C | C |
template0 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(4 行)
postgres=# \c dvdrental
データベース "dvdrental" にユーザ"postgres"として接続しました。
dvdrental=# \d
リレーションの一覧
スキーマ | 名前 | 型 | 所有者
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
public | actor | テーブル | postgres
public | actor_actor_id_seq | シーケンス | postgres
public | actor_info | ビュー | postgres
public | address | テーブル | postgres
public | address_address_id_seq | シーケンス | postgres
public | category | テーブル | postgres
public | category_category_id_seq | シーケンス | postgres
public | city | テーブル | postgres
public | city_city_id_seq | シーケンス | postgres
public | country | テーブル | postgres
public | country_country_id_seq | シーケンス | postgres
public | customer | テーブル | postgres
public | customer_customer_id_seq | シーケンス | postgres
public | customer_list | ビュー | postgres
public | film | テーブル | postgres
public | film_actor | テーブル | postgres
public | film_category | テーブル | postgres
public | film_film_id_seq | シーケンス | postgres
public | film_list | ビュー | postgres
public | inventory | テーブル | postgres
public | inventory_inventory_id_seq | シーケンス | postgres
public | language | テーブル | postgres
public | language_language_id_seq | シーケンス | postgres
public | nicer_but_slower_film_list | ビュー | postgres
public | payment | テーブル | postgres
public | payment_payment_id_seq | シーケンス | postgres
public | rental | テーブル | postgres
public | rental_rental_id_seq | シーケンス | postgres
public | sales_by_film_category | ビュー | postgres
public | sales_by_store | ビュー | postgres
public | staff | テーブル | postgres
public | staff_list | ビュー | postgres
public | staff_staff_id_seq | シーケンス | postgres
public | store | テーブル | postgres
public | store_store_id_seq | シーケンス | postgres
(35 行)
dvdrental=#