It happened so many times it deserves a self note. PostgreSQL installed and now it’s time to create a new user. Or should I say time to google for the create-user-command-I-never-remember?

To create a new user:

CREATE USER your_user WITH PASSWORD 'your_password';

If you want the user to also be able to create databases as you probably want for a local machine user:

CREATE USER your_user WITH PASSWORD 'your_password' CREATEDB;

Or you can grant CREATEDB to an existent user:

ALTER USER your_user CREATEDB;

And finally, if you want to get rid of an user:

DROP USER your_user;