In order to create a test user with password instead of peer authentication, let's create test user:
-Pmakes it prompt for the users password.
Alternatively, to create the password non-interactively https://stackoverflow.com/questions/42419559/postgres-createuser-with-password-from-terminal: Can't find a way using the
We can then login with that password with:which asks for the password we've just set, because the
-hoption turns off peer authentication, and turns off password authentication.
The password can be given non-interactively as shown at https://stackoverflow.com/questions/6405127/how-do-i-specify-a-password-to-psql-non-interactively with the
Now let's create a test database which
user0can access with an existing superuser account:
We can check this permission with:which now contains: The permission letters are explained at:
user0can now do the usual table operations on that table: