Create Role and matching database
suggest changeTo support a given application, you often create a new role and database to match.
The shell commands to run would be these:
$ createuser -P blogger
Enter password for the new role: ********
Enter it again: ********
$ createdb -O blogger blogger
This assumes that pg_hba.conf has been configured, for example:
# TYPE DATABASE USER ADDRESS METHOD
host sameuser all localhost md5
local sameuser all md5
sameuser matches only when the database name and the role name are the same. Since PostgreSQL 14 the default password_encryption is scram-sha-256. A password stored that way will not authenticate with md5 in pg_hba.conf; use scram-sha-256 there, or store the password with MD5 if you must keep md5. Reload the server after changing pg_hba.conf.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents