After creating a cluster and starting Postgres, the next step is to connect to and start creating databases and other objects. You may want to connect to Postgres as a client, create a database or create few tables, run some queries, and so on. To achieve this, we have a utility called psql. This utility acts as a client. psql is a client that can be used to interact with a PostgreSQL cluster and perform several actions. In the recipe, we shall discuss how psql and some of its shortcuts can be helpful for routine activities.
Getting ready
psql is a client that can be used to connect to the PostgreSQL server both locally and remotely (from another server). If psql is not executed as a Postgres user (defaults to Postgres when used on the database server as a Postgres OS user), then the appropriate database user should be used to connect to the PostgreSQL server to run the psql commands in this recipe.
How to do it...
Let's learn how...