Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/How To Connect To Remote Postgres Database From Command Line?
Next
Answered
Reece Tremblay
  • 17
Reece Tremblay
Asked: April 19, 20222022-04-19T22:34:02+00:00 2022-04-19T22:34:02+00:00In: whatever

How To Connect To Remote Postgres Database From Command Line?

  • 17

. Advertisement .

..3..

. Advertisement .

..4..

I’m a newbie, and learning about Postgres Database. I am not sure how to Connect To Remote Postgres Database. Could you tell me how to connect to remote Postgres Database from Command Line

♦ Suggestions of ITtutoria Team
Ideas: If you are a Linux user, connect to a remote database from the command line is very simple. On Mac OSX, it’s just as easy, but for Windows 10 it would take an extra step to install the Windows Subsystem for Linux (WSL).

How to connect to remote Postgres Database from Command Line

The correct way to connect to remote Postgres database server is: Here are the steps:

    • First of all, open a command prompt and type below commands.
    • After that, when you are connected to Postgres database, you can use any of following commands here
    PostgreSQL is an open source relational database management system (RDBMS). It is developed by The PostgreSQL Global Development Group and many other developers from around the world. And it has been available since 1993. Currently, it runs on Linux, Unix, and Microsoft Windows operating systems. I would highly recommend PostgreSQL for your project in this day and age because of its user-friendliness and robustness as well as its excellent performance.
    remote postgres database
    • 5 5 Answers
    • 102 Views
    • 0 Followers
    • 0
    Answer
    Share
    • Facebook
    • Report

    5 Answers

    • Voted
    • Oldest
    • Recent
    • Random
    1. Best Answer
      Chelsea O'Kelly
      2022-04-19T22:34:15+00:00Added an answer on April 19, 2022 at 10:34 pm

      I’ve tried some solutions but the simple method should be:

      How to connect to remore postgres database from command line
      ​
      psql -h <IP_Address> -p <port_no> -d <database_name> -U <DB_username> -W
      ​
      -W option will prompt for password
      ​
      psql -h 192.168.1.50 -p 5432 -d testdb -U testuser -W
      • 8
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report
    2. Lilith Johnson
      2022-04-19T22:34:10+00:00Added an answer on April 19, 2022 at 10:34 pm
      pg_dump -U postgres DATABASE_NAME > backup.sql
      ​
      • 20
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report
    3. Isabella Thomas
      2022-04-19T22:34:08+00:00Added an answer on April 19, 2022 at 10:34 pm

      Here is what you should do for this topic

      psql -h <IP_Address> -p <port_no> -d <database_name> -U <DB_username> -W
      ​
      -W option will prompt for password
      ​
      psql -h 192.168.1.50 -p 5432 -d testdb -U testuser -W
      ​
      • 16
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report
    4. Scott Rodriguez
      2022-04-19T22:34:05+00:00Added an answer on April 19, 2022 at 10:34 pm

      This is the solution that I found somewhere, this helped me and I hope that helps you

      $ psql -h <host> -p <port> -U <username> <database>
      • 12
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report
    5. Ariella Lam
      2022-04-19T22:34:12+00:00Added an answer on April 19, 2022 at 10:34 pm

      My suggestions for this question

      psql -U postgres
      drop database DATABASE_NAME;
      create database DATABASE_NAME;
      create user USER_NAME;
      alter role USER_NAME with password 'BITNAMI_USER_PASSWORD';
      grant all privileges on database DATABASE_NAME to USER_NAME;
      alter database DATABASE_NAME owner to USER_NAME;
      psql -U postgres DATABASE_NAME < backup.sql
      ​
      • 6
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Ask A Question
    • How to Split String by space in C++
    • How To Convert A Pandas DataFrame Column To A List
    • How to Replace Multiple Characters in A String in Python?
    • How To Remove Special Characters From String Python

    Explore

    • Home
    • Tutorial

    Footer

    ITtutoria

    ITtutoria

    This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

    @ ITTutoria Co Ltd.

    Tutorial

    • Home
    • Python
    • Science
    • Java
    • JavaScript
    • Reactjs
    • Nodejs
    • Tools
    • QA

    Legal Stuff

    • About Us
    • Terms of Use
    • Privacy Policy
    • Contact Us

    DMCA.com Protection Status

    Help

    • Knowledge Base
    • Support

    Follow

    © 2022 Ittutoria. All Rights Reserved.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.