user3813256
user3813256

Reputation: 812

createuser command for postgres failing on windows

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.

Upvotes: 1

Views: 2289

Answers (1)

Doon
Doon

Reputation: 20232

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.

Upvotes: 2

Related Questions