PostgreSQLでユーザパスワードを設定・変更する
PostgreSQLでユーザパスワードを設定・変更する
0.改訂履歴
1.はじめに
このドキュメントでは,PostgreSQLが管理しているユーザアカウントにパスワードを設定する手順を説明する.
なお,使用しているPostgreSQLは,RedHat Linux ES3上で稼働しているPostgreSQL 7.4.6である.
2.現在パスワードが設定されているか確認.
root@mars shinnai]# su - postgres
[postgres@mars postgres]$ psql -U postgres MyTestDB
Welcome to psql 7.4.6, the PostgreSQL interactive terminal.
Type: ¥copyright for distribution terms
¥h for help with SQL commands
¥? for help on internal slash commands
¥g or terminate with semicolon to execute query
¥q to quit
MyTestDB=#
|
MyTestDB=# select usename,passwd from pg_shadow;
usename | passwd
----------+-------------------------------------
postgres |
bill |
steve | md5005de840702849f1e96b7fed6a1eb2cf
(3 rows)
MyTestDB=#
|
- postgresユーザのパスワードの中がブランクである.
- つまり,パスワードが設定されていない.
3.パスワードを設定する
MyTestDB=# alter user postgres with password 'nagai_password_123!';
ALTER USER
MyTestDB=#
|
MyTestDB=# select usename,passwd from pg_shadow;
usename | passwd
----------+-------------------------------------
bill |
steve | md5005df84a702849f1e96a7f2d6a1db2cf
postgres | md59f444fd867fff4af92b63f2e2422f77f
(3 rows)
MyTestDB=#
|