Skip to content

Commit b22b529

Browse files
committed
Doc: Add a table of contents for the article using psql to connect to the database
1 parent 4b34175 commit b22b529

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

databases/access_postgresql/psql.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ For reference, these are the topics we will cover in the entire database tutoria
1616
- [Getting Started with PostgreSQL](/databases/getting_started_with_postgresql.md)
1717

1818

19-
## Connecting to the PostgreSQL Server Using `psql`
19+
### Table of Contents
20+
21+
Throughout this article, we will look at how to:
22+
23+
1. [Connect to the PostgreSQL Server Using `psql`](#connect-to-the-postgresql-server-using-psql)
24+
2. [Create Another User](#create-another-user)
25+
3. [Create A Super User](#create-a-super-user)
26+
4. [Create User Password](#create-user-password)
27+
5. [Change User Password](#change-user-password)
28+
6. [Connect to PostgreSQL As Another User](#connect-to-postgresql-as-another-user)
29+
30+
## Connect to the PostgreSQL Server Using `psql`
2031

2132
Now that you have installed postgreSQL, the first thing you want to do is to connect to its server. Every installation creates a default user called `postgres` who is associated with the default Postgres role. We will begin by connecting to the server using this user.
2233

@@ -147,3 +158,17 @@ You can then restart your PostgreSQL server:
147158
```python
148159
$ sudo service postgresql restart
149160
```
161+
162+
## Connect to PostgreSQL As Another User
163+
164+
So far, we have been using the default `postgres` user to access `psql`. Now that we have other users created and their passwords set up, let us try to log in as these users.
165+
166+
```python
167+
$ sudo -u muthoni psql
168+
169+
# Output
170+
sudo: unknown user: muthoni
171+
sudo: unable to initialize policy plugin
172+
```
173+
174+
Apparently, _muthoni_ is not recognized from the attempt above.

0 commit comments

Comments
 (0)