To create a user in PostgreSQL, we first connect to PostgreSQL.
To connect to PostgreSQL
You can read the article named “How To Connect To Database On PostgreSQL“.
After connecting, you can create user with the following script.
CREATE USER testuser WITH PASSWORD 'Asdf1234';
You can give permission to this user in any database.
But if you do not want unauthorized users in PostgreSQL to create a table under the public schema, I recommend you read the following article.
Because users created in PostgreSQL are allowed to connect to a database, they can create tables under the default schema, the public schema.
It was weird when I first heard about it. They will probably limit it in the future. This is still the case in version 10.0.
And you can list all users with below command