user3162553
user3162553

Reputation: 2859

How can I find all the information needed for a postgresql connection string?

I frequently run into the problem of trying to track down all the information such as the host, the user, the password, whether to use ssl, etc. Is there an easy way to retrieve this information from the psql terminal?

host     = "localhost"
port     = 5432
user     = "postgres"
password = "password"
dbname   = "database"

I typically create databases with createdb but I don't know what user or password it is using.

Upvotes: 2

Views: 5755

Answers (1)

user3162553
user3162553

Reputation: 2859

To find the host, port and user:

  1. psql to open up terminal to postgres
  2. \c database to connect to database
  3. \conninfo to retrieve info about connection.

To reset the password:

  1. psql to open terminal to postgres
  2. \password to set new password (edited)

Upvotes: 5

Related Questions