1

I installed postgresql on Windows. When I run createuser in the DOS prompt, it fails with the following error:

createuser testuser

could not connect to database postgres : FTAL: role testuser does not exist 

I have tried switching the pg_hba file from md5 to trust, but that has not solved the issue. Any thoughts? The database server itself is running- I was able to connect to it using another tool. Also, the path has a reference to the postgres/bin directory.

3
  • what is your root user? try createuser -U pgsql testuser Commented Sep 23, 2015 at 23:06
  • replacing pgsql with a superuser account as needed Commented Sep 23, 2015 at 23:10
  • please post as answer and I will accept. How do I setup the pwd for the new user? Commented Sep 23, 2015 at 23:23

1 Answer 1

2

you need to specify a super user account in order to create a user

createuser -U pgsql testuser 

if you plan on using a password for this user you can use -P or --pwprompt

createuser -P  -U pgsql testuser

and it will prompt you for the password.

replace pgsql with a superuser account.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.