Create a PostgreSQL user and a database, with the new user set as the owner of that database.

# Log into psql as the superuser
psql -U postgres # default superuser is usually 'postgres', but adjust accordingly

Note: PostgreSQL may prompt for a password depending on your environment and pg_hba.conf settings. If it logs in without prompting, you’re likely using trust or peer authentication. You can force a password prompt with -W.

Then inside the psql prompt:

CREATE USER myuser WITH PASSWORD 'mypassword';
CREATE DATABASE mydb OWNER myuser;

That’s it! Don’t forget to \q to exit the psql shell.