Using psql to connect to PostgreSQL in SSL mode

后端 未结 7 1448
攒了一身酷
攒了一身酷 2021-01-30 07:50

I am trying to configure ssl certificate for PostgreSQL server. I have created a certificate file (server.crt) and key (server.key) in data directory and update the parameter SS

7条回答
  •  一整个雨季
    2021-01-30 08:45

    psql below 9.2 does not accept this URL-like syntax for options.

    The use of SSL can be driven by the sslmode=value option on the command line or the PGSSLMODE environment variable, but the default being prefer, SSL connections will be tried first automatically without specifying anything.

    Example with a conninfo string (updated for psql 8.4)

    psql "sslmode=require host=localhost dbname=test"
    

    Read the manual page for more options.

提交回复
热议问题