pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Requiring pass and database psql shell command
5+ messages / 4 participants
[nested] [flat]

* Requiring pass and database psql shell command
@ 2018-03-05 12:55  Łukasz Jarych <jaryszek@gmail.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Łukasz Jarych @ 2018-03-05 12:55 UTC (permalink / raw)
  To: pgsql-general

Hi Guys,

do you have also problem that every time you have to log into your database
using shell and psql?

I have to write over and over localhost, username, password...how to force
shell to remember this?

Best,
Jacek

Attachments:

Przechwytywanie.PNG (image/png, 25.1K) download view image
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: Requiring pass and database psql shell command
@ 2018-03-05 13:33  James Keener <jim@jimkeener.com>
  parent: Łukasz Jarych <jaryszek@gmail.com>
  2 siblings, 1 reply; 5+ messages in thread

From: James Keener @ 2018-03-05 13:33 UTC (permalink / raw)
  To: Łukasz Jarych <jaryszek@gmail.com>; pgsql-general

Well, it's not a problem, it's the way it's designed and it's a sensible design. Check https://www.postgresql.org/docs/9.3/static/libpq-envars.html for more info on doing what you want.

On March 5, 2018 7:55:46 AM EST, "Łukasz Jarych" <jaryszek@gmail.com> wrote:
>Hi Guys,
>
>do you have also problem that every time you have to log into your
>database
>using shell and psql?
>
>I have to write over and over localhost, username, password...how to
>force
>shell to remember this?
>
>Best,
>Jacek

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Requiring pass and database psql shell command
@ 2018-03-05 14:03  Łukasz Jarych <jaryszek@gmail.com>
  parent: James Keener <jim@jimkeener.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Łukasz Jarych @ 2018-03-05 14:03 UTC (permalink / raw)
  To: James Keener <jim@jimkeener.com>; +Cc: pgsql-general

thank you!!

Jacek

2018-03-05 14:33 GMT+01:00 James Keener <jim@jimkeener.com>:

> Well, it's not a problem, it's the way it's designed and it's a sensible
> design. Check https://www.postgresql.org/docs/9.3/static/libpq-envars.html
> for more info on doing what you want.
>
>
> On March 5, 2018 7:55:46 AM EST, "Łukasz Jarych" <jaryszek@gmail.com>
> wrote:
>>
>> Hi Guys,
>>
>> do you have also problem that every time you have to log into your
>> database using shell and psql?
>>
>> I have to write over and over localhost, username, password...how to
>> force shell to remember this?
>>
>> Best,
>> Jacek
>>
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Requiring pass and database psql shell command
@ 2018-03-05 14:23  Ron Johnson <ron.l.johnson@cox.net>
  parent: Łukasz Jarych <jaryszek@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Ron Johnson @ 2018-03-05 14:23 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

The password file is also a solution.

https://www.postgresql.org/docs/current/static/libpq-pgpass.html

On 03/05/2018 07:33 AM, James Keener wrote:
> Well, it's not a problem, it's the way it's designed and it's a sensible 
> design. Check https://www.postgresql.org/docs/9.3/static/libpq-envars.html 
> for more info on doing what you want.
>
> On March 5, 2018 7:55:46 AM EST, "Łukasz Jarych" <jaryszek@gmail.com> wrote:
>
>     Hi Guys,
>
>     do you have also problem that every time you have to log into your
>     database using shell and psql?
>
>     I have to write over and over localhost, username, password...how to
>     force shell to remember this?
>
>     Best,
>     Jacek
>
>

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Requiring pass and database psql shell command
@ 2018-03-05 14:33  David G. Johnston <david.g.johnston@gmail.com>
  parent: Łukasz Jarych <jaryszek@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2018-03-05 14:33 UTC (permalink / raw)
  To: Łukasz Jarych <jaryszek@gmail.com>; +Cc: pgsql-general

On Mon, Mar 5, 2018 at 5:55 AM, Łukasz Jarych <jaryszek@gmail.com> wrote:

> Hi Guys,
>
> do you have also problem that every time you have to log into your
> database using shell and psql?
>
> I have to write over and over localhost, username, password...how to force
> shell to remember this?
>
>
​Use a service file.​

psql "service=mydb" -c "SELECT 1;"

​https://www.postgresql.org/docs/10/static/libpq-pgservice.html

I also, for scripts, simply define a function at the top of the script
psql_* and invoke that function instead of psql directly.

I use .pgpass for passwords

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2018-03-05 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05 12:55 Requiring pass and database psql shell command Łukasz Jarych <jaryszek@gmail.com>
2018-03-05 13:33 ` James Keener <jim@jimkeener.com>
2018-03-05 14:03   ` Łukasz Jarych <jaryszek@gmail.com>
2018-03-05 14:23 ` Ron Johnson <ron.l.johnson@cox.net>
2018-03-05 14:33 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox