You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: databases/access_postgresql/psql.md
+26-1Lines changed: 26 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,18 @@ For reference, these are the topics we will cover in the entire database tutoria
16
16
-[Getting Started with PostgreSQL](/databases/getting_started_with_postgresql.md)
17
17
18
18
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`
20
31
21
32
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.
22
33
@@ -147,3 +158,17 @@ You can then restart your PostgreSQL server:
147
158
```python
148
159
$ sudo service postgresql restart
149
160
```
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 inas 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_ isnot recognized from the attempt above.
0 commit comments