"Postgres login" FAQ: How do I log into a Postgres database from the command line?
To log into a Postgres database from the command line, use the
psql command. Let's take a look at a few psql command line options you can use.
Postgres login commands
If you are logged into the same computer that Postgres is running on you can use the following psql login command, specifying the database (
mydb) and username (
Here's a quick tabular list of Postgres commands related to listing information about a Postgres database. (Technically these are "psql commands", because you issue these commands from the psql command line program.)
These Postgres commands help you answer questions like "What tables are in this postgres database?", or "What databases do I have within Postgres?" (a handy question when it comes time for spring cleaning), and other questions. Other popular psql commands are related to permissions, indexes, views, and sequences.