At this point in the book, we have learned how to install PostgreSQL and how to configure users. Let's now see how to connect to our database. In the next four steps, we will see how easy it is to do this:
- Start by connecting to your psql environment:
postgres@pgdev:~$ psql
psql (12.1 (Debian 12.1-1.pgdg100+1))
Type "help" for help.
postgres=#
- Next, switch on the expanded mode using the \x command:
postgres=# \x
Expanded display is on.
- Then list all the databases that are present in the cluster:
postgres=# \l
List of databases
-[ RECORD 1 ]-----+----------------------
Name | forumdb
Owner | postgres
Encoding | UTF8
Collate | en_US.UTF-8
Ctype | en_US.UTF-8
Access privileges |
- Finally, connect to the forumdb database:
postgres=# \c forumdb
You are now connected to database "forumdb" as user "postgres".
forumdb=#
Now, that we have finished setting up our developing...