Thread: Creating a second database on the same computer
(Postgres 8.4, Windows XP)
I'd like to create a second (and possibly more) database cluster on my computer for testing an application. The clusters are never required to be used at the same time.
The default location of the cluster is here: "C:\Program Files\PostgreSQL\8.4\data". I also have a different database cluster sent to me by a colleague. I have placed this in I:\pgsql and used the guide at
http://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows
to change where Postgres looks for data. This works fine.
I tried to make a new cluster of my own by running ""C:\Program Files\PostgreSQL\8.4\bin\initdb" -U postgres -D H:\pgdata". This appears to have created the appropriate files but when I try to run the service from the Windows services utility or the start menu I get this error:
System error 1069 has occurred. The service did not start due to a logon failure.
If I try to start the program from the command line using
"C:/Program Files/PostgreSQL/8.4/bin/pg_ctl.exe" runservice -N "postgresql-8.4" -D "H:\pgdata" -w
I get the error:
pg_ctl: could not start service "postgresql-8.4": error code 1063
I have run initdb under both my (admin-rights) username and postgres (which required me to set security permissions on the H:\pgdata directory) and using the -w option. Both ways give me the above errors, but neither asks for a password - authentication is turned off in pg_hba.conf as per default.
Now the default cluster directory and I:\pgsql also give me the above errors. As part of trying things out I have changed the postgres password from and then back to what it was originally set to. Does this have anything to do with the error?
Does anyone know what I'm doing wrong and how I can create another database cluster? (And how can I fix my current cluster!)
Thanks.
I'd like to create a second (and possibly more) database cluster on my computer for testing an application. The clusters are never required to be used at the same time.
The default location of the cluster is here: "C:\Program Files\PostgreSQL\8.4\data". I also have a different database cluster sent to me by a colleague. I have placed this in I:\pgsql and used the guide at
to change where Postgres looks for data. This works fine.
I tried to make a new cluster of my own by running ""C:\Program Files\PostgreSQL\8.4\bin\initdb" -U postgres -D H:\pgdata". This appears to have created the appropriate files but when I try to run the service from the Windows services utility or the start menu I get this error:
System error 1069 has occurred. The service did not start due to a logon failure.
If I try to start the program from the command line using
"C:/Program Files/PostgreSQL/8.4/bin/pg_ctl.exe" runservice -N "postgresql-8.4" -D "H:\pgdata" -w
I get the error:
pg_ctl: could not start service "postgresql-8.4": error code 1063
I have run initdb under both my (admin-rights) username and postgres (which required me to set security permissions on the H:\pgdata directory) and using the -w option. Both ways give me the above errors, but neither asks for a password - authentication is turned off in pg_hba.conf as per default.
Now the default cluster directory and I:\pgsql also give me the above errors. As part of trying things out I have changed the postgres password from and then back to what it was originally set to. Does this have anything to do with the error?
Does anyone know what I'm doing wrong and how I can create another database cluster? (And how can I fix my current cluster!)
Thanks.
It turns out that there was a hard disk error on my C: drive. Running chkdsk, uninstalling postgres and re-installing it solved the problem. The steps I outlined now work.
Thanks.
Thanks.