Thread

  1. Requiring pass and database psql shell command

    Łukasz Jarych <jaryszek@gmail.com> — 2018-03-05T12:55:46Z

    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
    
  2. Re: Requiring pass and database psql shell command

    James Keener <jim@jimkeener.com> — 2018-03-05T13:33:18Z

    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.
  3. Re: Requiring pass and database psql shell command

    Łukasz Jarych <jaryszek@gmail.com> — 2018-03-05T14:03:43Z

    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.
    >
    
  4. Re: Requiring pass and database psql shell command

    Ron Johnson <ron.l.johnson@cox.net> — 2018-03-05T14:23:12Z

    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.
    
  5. Re: Requiring pass and database psql shell command

    David G. Johnston <david.g.johnston@gmail.com> — 2018-03-05T14:33:57Z

    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.