PostgreSQL
PostgreSQL
※前提条件:本情報はPostgreSQL 9.2 を基づいて説明してる
\PostgreSQL\9.2\bin\initdb.exe -U postgres -A password -E UTF8 -D C:\Users\PostgreSQL\9.2\data --locale=C -W
説明:
-U | データベースのユーザ名 | -A | ユーザログイン認証の方法 | -D | データベースデータの格納場所 | -W | -Uで指定したユーザのパスワードを強制的に入力させる |
trust | Allow the connection unconditionally. This method allows anyone that can connect to the PostgreSQL database server to login as any PostgreSQL user they like, without the need for a password. | reject | Reject the connection unconditionally. This is useful for "filtering out" certain hosts from a group. | md5 | Require the client to supply an MD5-encrypted password for authentication. | password | Require the client to supply an unencrypted password for authentication. Since the password is sent in clear text over the network, this should not be used on untrusted networks. | gss | Use GSSAPI to authenticate the user. This is only available for TCP/IP connections. | sspi | Use SSPI to authenticate the user. This is only available on Windows. | krb5 | Use Kerberos V5 to authenticate the user. This is only available for TCP/IP connections. | ident | Obtain the operating system user name of the client (for TCP/IP connections by contacting the ident server on the client, for local connections by getting it from the operating system) and check if it matches the requested database user name. | ldap | Authenticate using an LDAP server. | cert | Authenticate using SSL client certificates. | pam | Authenticate using the Pluggable Authentication Modules (PAM) service provided by the operating system. |
initdbコマンドでデータベースの初期化に、バッチファイルを利用して、パスワード設定の自動化を図ろうとしたが、--pwfileパラメータがうまく動作できなく、以下の方法でパスワードを設定した。
手順1:以下のコマンドでデータベースを初期化する
\PostgreSQL\9.2\bin\initdb.exe -U postgres -A trust -E UTF8 -D C:\Users\PostgreSQL\9.2\data --locale=C
手順2:changePwd.sqlファイルを作成、中身を以下にする
alter user postgres with password 'new password';
手順3:パスワード修正ファイルを適用する
\PostgreSQL\9.2\bin\psql.exe -U postgres -f changePwd.sql
フレッツ光が月額556円~【GMOとくとくBB】
コメント:
|