Search code examples
postgresqlpostgresql-9.1postgresql-9.3postgresql-9.4

How to run postgresql from Command line and know available Databases in Windows


I am very new to postgreSQL and struggling to create a connection in my Eclipese.

Here is what I have done till now:

  1. Installed DBeaver plugin for eclipse from marketplace.
  2. Installed PostgreSQL version 10 from https://www.postgresql.org/download/windows/

  3. Now I attempt to create a connection in Eclipse but I get an error "FATAL: password authentication failed for user "testuser"

I checked through a similar thread ( Getting authentication failed error with postgresql from command line ) but could not resolve the issue.

Could you please help.


Solution

  • To connect the PostgreSQL via Command line you have to install a PostgreSQL provided tool called "psql" if not installed already.

    Then use the below command to connect to PostgreSQL database.

    psql -h localhost -p 5432 -U postgres 
    

    Explanation:

    localhost: is the hostname of machine where PostgreSQL is installed.
    5432 : is the default PostgreSQL port
    postgres : is the username of to connect to DB
    

    Solution for your issue:

    FATAL: password authentication failed for user "testuser"
    

    As error message specified, either user not exists on database or the password that you supplied to connect is incorrect. Re-verify your user and password, and try again.

    All the best.