Debian(Buster) Gnu/Linux の PostGreSQL 12 の ~/.pgpass の具体例は何ですか?

Debian(Buster) Gnu/Linux の PostGreSQL 12 の ~/.pgpass の具体例は何ですか?

~のためコロナ19を助けてくださいGPLv3+プロジェクト(子コミット109d5fb90f6ae...)私たちは実行の具体的で実用的な例が必要です文書~/.pgpassDebian(Buster) Gnu/Linux x86-64 で。

私たちはデバッグしているので、ルートなしでこれを行うことができるはずです。

Post-GreSQL存在するダーバン/バスターはバージョン12です。私はこれの指示に従いました。読む.md

私は生涯PostGreSQLデータベースを配布したことがありません。

以下の例はうまくいかず、その理由を理解できません(フランス語の説明について申し訳ありません)。

# fichier ~/.pgpass pour Basile en mars 2020
# voir  https://www.postgresql.org/docs/current/libpq-pgpass.html 
localhost:*:helpcovid_db:helpcovid_usr:test_helpcovid

このファイルは私だけが読むことができます。

% ls -l .pgpass 
-rw------- 1 basilest basilegr 164 Mar 22 12:38 .pgpass

トラブルシューティング済み子コミット5733fed27967d13

generate-config.pyPythonスクリプトを使用してください。


PS。これhttps://github.com/bstarynk/helpcovidプロジェクトの時期は2020年3月です。進行中のタスク

ベストアンサー1

私はUbuntuを使います。このリンクのpostgresqlガイドに従ってください。https://itsfoss.com/install-postgresql-ubuntu/

その後、そのプロジェクトでコンパイルエラーが発生しましたが、make localhost0postgresql接続部分は.pgpass次のように動作しました。

developer@1604:~/proj/github/helpcovid$ sudo su - postgres
postgres@1604:~$ psql -c "alter user postgres with password 'StrongPassword'"
ALTER ROLE
postgres@1604:~$ createuser dbuser1
postgres@1604:~$ createdb testdb -O dbuser1
postgres@1604:~$ psql -l  | grep testdb
 testdb    | dbuser1  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
postgres@1604:~$ psql
psql (11.7 (Ubuntu 11.7-2.pgdg18.04+1), server 9.5.14)
Type "help" for help.

postgres=# alter user dbuser1 with password 'StrongPassword';
ALTER ROLE
postgres=# create table test_table ( id int,first_name text, last_name text );
CREATE TABLE
postgres=# insert into test_table (id,first_name,last_name) values (1,'John','Doe');
INSERT 0 1
postgres=# select * from test_table;
 id | first_name | last_name 
----+------------+-----------
  1 | John       | Doe
(1 row)

postgres=# 

その後、私の接続文字列は私のホームディレクトリにあります。

$ cat .pgpass 
localhost:5432:testdb:dbuser1:StrongPassword

プロンプトに従って接続を確立できます。

developer@1604:~$ psql -d testdb -h localhost -U dbuser1
psql (11.7 (Ubuntu 11.7-2.pgdg18.04+1), server 9.5.14)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

testdb=> 

おすすめ記事