首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Debian (Buster) Gnu/Linux上~/. PostGreSQL 12的具体例子

Debian (Buster) Gnu/Linux上~/. PostGreSQL 12的具体例子
EN

Unix & Linux用户
提问于 2020-03-22 15:16:29
回答 1查看 1.3K关注 0票数 0

乐于事 GPLv3+项目(git提交109d5fb90f6ae .)我们需要一个在Debian (Buster) Gnu/Linux86-64上运行的文件~/.pgpass的具体和工作示例。

我们正在进行调试,因此我们需要能够在没有根的情况下做到这一点。

PostGreSQL on Debian/Buster是12版。

我一生中从未部署过任何PostGreSQL数据库。

下面的例子不起作用,我不明白为什么(对法语的评论很抱歉)

代码语言:javascript
复制
# fichier ~/.pgpass pour Basile en mars 2020
# voir  https://www.postgresql.org/docs/current/libpq-pgpass.html 
localhost:*:helpcovid_db:helpcovid_usr:test_helpcovid

只有我才能读到这个文件:

代码语言:javascript
复制
% ls -l .pgpass 
-rw------- 1 basilest basilegr 164 Mar 22 12:38 .pgpass

问题在git提交5733fed27967d13

中得到解决

使用我们的generate-config.py python脚本

PS。https://github.com/bstarynk/helpcovid项目将于2020年3月开始实施,work正在进行

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2020-03-23 20:38:19

我使用Ubuntu,只需遵循https://itsfoss.com/install-postgresql-ubuntu/链接中的postgresql指南即可

然后,在这个项目中,我遇到了一个编译错误,试图使用make localhost0,但是postgresql连接部分与.pgpass的工作方式如下。

代码语言:javascript
复制
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=# 

那么我的连接字符串在我的主目录中。

代码语言:javascript
复制
$ cat .pgpass 
localhost:5432:testdb:dbuser1:StrongPassword

我可以从提示符中连接:

代码语言:javascript
复制
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=> 
票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/574269

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档