"ERROR: role "$user" does not exist" when setting up postgresql server

When I tried to follow the "alternative server setup" as detailed here: PostgresSQL, I got the error ERROR: role "$user" does not exist when I ran postgres=# \password $USER and entered my new password. The instructions are very simple, and I followed everything to the letter. Would anyone know what's wrong with my setup?

1 Answer

It is always best to copy/paste the command and error message so we might check your syntax.

Two thoughts - "$USER" is a variable, you replace it with the user name you wish to use. Also $user is not the same as $USER.

So ...

sudo -u postgres createuser --superuser your_user
sudo -u postgres psql

You should not have a postgres prompt, again change "$USER" to the actual user name you wish to use ...

postgres=# \password your_user

and on ...

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like