How to install initdb manually on Win XP

PostgreSQL is the database server used to store information. Do you have a question or are you having problem with PostgreSQL? If so, post them here.

Moderator: Moderators

How to install initdb manually on Win XP

Postby vesper » Fri Jul 18, 2008 4:17 am

disclaimer: This is a rough guide about installing initdb manually for those having problems with the Postgres installer. I really wouldn't recommend following the advice in this post unless you've tried EVERYTHING else. I'm not a computer professional and I can't guarantee this will work for you so try this very carefully and at your own risk. This guide gets messy, and I'm recalling from memory so it might have some inaccuracies here and there... Obviously I'm not responsible if you break your computer.

I have Win XP and was running into the "failed to run initdb:1" error, despite having my admin/privileges setup supposedly correct. After trying nearly everything and having no luck finding a process that was blocking the install, I decided to find a way to run initdb manually and get around the installer's "failed to run initdb:1" error. Here's what I did:

The easy part
fresh complete uninstall/re-install PT3 w/ PostgreSQL
Run PostgreSQL installer
UNCHECK the box that prompts you to install the database as a service (this will install the program and service but won't run initdb in the install)
continue with the install of postgreSQL

Running initdb manually
start->run-> cmd
in the command prompt type: cd "c:\program files\postgresql\8.3\bin" (include the quotations)
the directory should be changed now, type in: initdb -W -A md5 -D c:/data
(roughly this means you're going to make the postgre user and create the "data" folder in c:\ instead of the usual postgresql install path.)
If your problem is the same as mine you'll have to bypass passwords later, but remember it just in case.

there should now be a folder called "data" in C:\, you should verify it's there.
drag and drop the "data" folder that you created into C:\program files\postgresql\8.3\
Restart your computer
start->all programs->postgresql->start database
open up pokertracker 3
type in the password...it probably won't work yet and come up with more errors.

Unable to connect to this database errors
Now you're probably getting an "unable to connect to this database" error. If this is the case, you need to look at what the database log says:

If it says ident authentication failed for user "postgres", you have to remove password requirements:
To remove password requirements go to start -> postgresql -> configuration files -> pg_hba.cfg and scroll to the bottom of this file. In the two places you see md5, replace them w/the word trust, then save the file. Local queries to the database will no longer be password validated.

Now try it. That solves it for most people, but you might a "role "postgres" does not exist" error next, as I did. The solution for this is to create the postgres user:
start -> postgresql -> command prompt
type in "createuser postgres"

Now the password requirement is overridden and the postgres user exists.
OK hopefully now it's ready to go. I actually hope no one needs to use this guide, use it as a last resort. The main problem is that you'll have to run the database every time you want to use PT. If anyone knows a workaround to that, please let me know.

Oh and thanks to keggler who was very kind to wade through emails and procmon logs trying to help me out.
vesper
 
Posts: 5
Joined: Wed Jul 09, 2008 12:16 pm

Re: How to install initdb manually on Win XP

Postby WhiteRider » Fri Jul 18, 2008 4:26 am

Thanks for writing this, I've added a link to it in the Database / Postgres FAQ.
WhiteRider
Moderator
 
Posts: 53961
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: How to install initdb manually on Win XP

Postby keggler » Fri Jul 18, 2008 5:40 am

well done vesper for sticking with it...

i have to think that by creating the folders in the c:\ root it has to be the original permissions on the c:\program files folder that were messed up...

it's got to be a permission or registry key this high up, because by walloping postgres and it's folders and the user prior to a fresh install would have erased the permissions - maybe it's a rogue registry key somewhere that's left after the uninstall??


susan
keggler
 
Posts: 640
Joined: Sun Jun 01, 2008 4:53 am

Re: How to install initdb manually on Win XP

Postby pomop » Thu Dec 11, 2008 7:13 pm

Excellent. Thanks. Solved my problem.

Just a little thing though:

It's "createuser postgres" and not "create user postgres"

Once again, thanks for this guide :)
pomop
 
Posts: 4
Joined: Thu Dec 11, 2008 2:35 pm

Re: How to install initdb manually on Win XP

Postby Peter Rhodan » Tue Jan 06, 2009 1:39 am

that didnt work for me - same result - it removes the db at the end - what the hell is all the 'd:\myplay.pif' is not a recognisable command stuff??? There are lines of it

apart from the endless d:\myplay.pif lines it all seems to be ok till here:

creating configeration files ... ok
creating template1 database in c:/data/base/1 ... 'd:\myplay.pif' is not recognized as an internal or external command, operable program or batch file
child process excited with exit code 1
initdb: removing data directory "c:/data"
Peter Rhodan
 
Posts: 1
Joined: Mon Jan 05, 2009 5:26 pm

Re: How to install initdb manually on Win XP

Postby kraada » Tue Jan 06, 2009 10:27 am

I'm not sure what's causing that error message; it is quite odd. I'd recommend taking a look at the official uninstall/reinstall PostgreSQL guide and working through that and seeing if you get stuck anywhere.

If you do, let me know where in the document you're having problems and we'll go from there.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: How to install initdb manually on Win XP

Postby thedean88 » Wed Jan 28, 2009 7:23 pm

when i try to create user it doesn't let me what am i supposed to type exactly?
thedean88
 
Posts: 3
Joined: Wed Jan 28, 2009 7:13 pm

Re: How to install initdb manually on Win XP

Postby kraada » Thu Jan 29, 2009 10:38 am

It should be just:
CREATE USER postgres;


what error message is it giving you?
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: How to install initdb manually on Win XP

Postby thedean88 » Sat Jan 31, 2009 3:13 am

it is saying " 'create' is not recognized as an internal or external command operable program or batch file."
thedean88
 
Posts: 3
Joined: Wed Jan 28, 2009 7:13 pm

Re: How to install initdb manually on Win XP

Postby kraada » Sat Jan 31, 2009 10:20 am

I just looked back at the OP and he has one slight mistake (I'll edit it shortly).

The Windows program to create a user is called createuser not create user.

CREATE USER is a PostgreSQL command, usable at a PostgreSQL command prompt; createuser is a windows program runnable from the Windows command prompt.

The short answer is: createuser followed by your username will work.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Next

Return to PostgreSQL [Read Only]

Who is online

Users browsing this forum: No registered users and 9 guests

cron
highfalutin