I use Windows 7 on my own home computer. I have installed PostgreSQL and now I would like to create an database.

I tried with createdb mydatabase but I got this error message:

createdb: could not connect to database postgres: FATAL: role "Jonas" does
not exist

I have also tried to create a role "Jonas" with createuser Jonas but I got the same error, even if I was logged in as Administrator in PowerShell.

How can I create a PostgreSQL database on my Windows 7 machine?

link|improve this question

feedback

1 Answer

up vote 4 down vote accepted

http://www.postgresql.org/docs/8.1/static/tutorial-createdb.html

Another response could be this:

createdb: could not connect to database postgres: FATAL:  user "joe" does not
exist

where your own login name is mentioned. This will happen if the administrator has not created a PostgreSQL user account for you. (PostgreSQL user accounts are distinct from operating system user accounts.) If you are the administrator, see Chapter 18 for help creating accounts. You will need to become the operating system user under which PostgreSQL was installed (usually postgres) to create the first user account.

link|improve this answer
1  
I tried to start PowerShell as Administrator and then execute createuser Jonas but I got the same error message. – Jonas Dec 10 '10 at 22:34
Did you try to start PowerShell as postgres? – ta.speot.is Dec 10 '10 at 22:42
No, how can I do that? I asked a related question to solve this, but that only works for Administrator. – Jonas Dec 10 '10 at 22:52
It worked when I started PowerShell with runas /user:ComputerName\postgres powershell and then executed createuser Jonas – Jonas Dec 10 '10 at 23:34
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.