PostgreSQL Connecting to a Database: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:
Connect to a [[PostgreSQL_Concepts#Database|database]].
Connect to a [[PostgreSQL_Concepts#Database|database]].


Options:
=Options=


==-h|--host= ==
==-U|--username= ==
==-d|--dbname= ==
=Examples=
==Connect to a Remote Database==


  psql -h <''host-name''> -U <''username''> -d <''database-name''>
  psql -h <''host-name''> -U <''username''> -d <''database-name''>


  psql -h dev01.example..us-west-2.rds.amazonaws.com -U root -d dev01
  psql -h dev01.example..us-west-2.rds.amazonaws.com -U root -d dev01


==Connect to the Default Database==
==Connect to the Default Database==

Revision as of 23:23, 14 November 2018

Internal

Connect

Connect to a database.

Options

-h|--host=

-U|--username=

-d|--dbname=

Examples

Connect to a Remote Database

psql -h <host-name> -U <username> -d <database-name>
psql -h dev01.example..us-west-2.rds.amazonaws.com -U root -d dev01

Connect to the Default Database

psql -h localhost -U admin

Connect as a Specific User to a Database

psql -U <username> <dbname>