Help me get Postgre running. Please.
February 20, 2007 6:42 PM   Subscribe

I'm trying to get Postgre running on my winxp thinkpad. Please hold my hand. I can't get this users stuff straight.

I went through the normal install process as an admin, which I think might have been a mistake. Postgre created a folder in my documents and settings dir called postgres, but it doesn't come up when I go to the windows log in screen. I remember picking a password, and also at some point an extremely long password was generated for me. I wrote them both down.

I open the cmd prompt inside the pg directory and run createdb. I get a message saying that an admin can't create the database. So I try logging in as postgres (which isn't listed in the normal xp users control panel dialogue) with both passwords and neither work. Then I made a non-admin account and tried logging in as that account and running it, but then createdb is not a valid command.

Can someone tell me exactly what I need to do? I have almost no experience with the command line and I avoid dealing with user accounts as much as possible.

Assume no experience.
posted by miniape to Computers & Internet (3 answers total)
"Postgresql" or "Postgres".

The Postgres clients usually take a "--username=foo" parameter, which may be what you should set. In any case, experiment with "--help" and see what options you can specify.

I'm accustomed to Unixes, which have proper users, so it may be different for you.
posted by cmiller at 7:10 PM on February 20, 2007

There is a lot of stuff going on here, and you're going to be eternally confused unless you read (and understand) the Postgres docs. Particularly, the entire Server Administration section. Now, to answer your questions...

The first user you created (probably the one with the long password) is a Windows users that the Postgres server logs in as. This is not an interactive user. You should not be trying to login as this user. It's 100% for the database service only.

The second user was a user inside the database. Postgres, like many databases, keeps an internal list of users that is entirely separate from what your system maintains as users. This is because what the database server has different needs for users than the system. To create a database you need to login as a user from the database server. This is not (necessarily) the same user as your Windows user.

Now, how to authenticate. Postgres has a flexible authentication system. One of the defaults modes is to just trust that anyone on the local system is who they say they are. So, first thing I would try is this:

createdb -U postgres a_database_name

If that doesn't work, then the easy, trust local users scheme is not enabled. Try this then:

createdb -U postgres -W a_database_name

Enter the password for the second user you created.

If none of those work, then you're best off asking on the postgres-users email list.

Also, there's a graphical client if you don't like the command line.
posted by sbutler at 7:16 PM on February 20, 2007

Thanks both. As my name implies I'm just a little ape. Turns out I was doing everything right but I must have had my caps lock key on when I set the password. Everything is swell now.

Special thanks for the server admin docs and the graphical client sbutler.
posted by miniape at 6:19 AM on February 21, 2007

« Older Palliatives for the common cold?   |   I want to entertain you! Newer »
This thread is closed to new comments.