C:\Program Files\PostgreSQL\8.x\bin>の環境変数を設定しておく再インストールする場合は次の作業を行っておく。
C:\Program Files\PostgreSQL\8.x\dataフォルダを削除するユーザーの作成
createuser -S -D -R -P -E wikiuser(then enter the password)
Enter password for new role:(wikuserのパスワードを設定する)
Enter it again:
Password:(スーパーユーザーのパスワード)
CREATE ROLE
作成時のオプションの意味は以下の通り。
createdb -E UTF8 -O wikiuser wikidb
psql -U ユーザー名 -d データベース
スーパーユーザーでデータベースを指定せずに接続するには次のようなコマンドを入力する。
psql template1
pg_config --version
括弧内はエイリアス。
クライアントのエンコーディングを表示する
show client_encoding;
サーバーのエンコーディングを表示する
show server_encoding;
クライアントのエンコーディングを設定する
SET client_encoding TO sjis;
psql -l
Ubuntuにおいてpostgresユーザーにはパスワードが設定されていないので 次のコマンドによって設定を行う。
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'パスワード'"
http://www.stickpeople.com/projects/python/win-psycopg/index.html からPythonのバージョンにあったバイナリをダウンロードする。
sudo apt-get install python-psycopg2
参考
トップページに戻る