punk.kish at gmail.com
Tue Sep 13 14:32:41 PDT 2011
On Sep 13, 2011, at 4:07 PM, Brandon Allbery wrote:
> On Tue, Sep 13, 2011 at 16:59, Puneet Kishor <punk.kish at gmail.com> wrote:
>> $sudo su postgres -c '/opt/local/lib/postgresql90/bin/pg_ctl start -D
>> /path/to/db/postgresql90/defaultdb -l ~/Logs/postgresql90-server/main.log'
>> but, I don't know the password for the 'postgres' user
> Are you using the actual command you quoted? The "sudo" shifts to root,
> which doesn't need a password to "su postgres".
well, almost... but I must come clean. I installed postgresql90 and postgresql90-server (by the way, I am not quite sure what the difference is between the two). However, I already have a working install of postgres on another computer, so I decided to bring the db over by copying it. On the original computer, the date were stored in `/opt/local/var/db/postgresql90/defaultdb` and I brought it over to the new computer at `/Volumes/bigdrive/Data/db/postgresql90/defaultdb`.
I changed the owner:group of the data location to postgres:postgres via
$sudo chown postgres:postgres /Volumes/bigdrive/db/postgresql90/defaultdb
$sudo su postgres -c '/opt/local/lib/postgresql90/bin/initdb -D /Volumes/bigdrive/Data/db/postgresql90/defaultdb'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".
initdb: directory "/Volumes/bigdrive/Data/db/postgresql90/defaultdb" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/Volumes/bigdrive/Data/db/postgresql90/defaultdb" or run initdb
with an argument other than "/Volumes/bigdrive/Data/db/postgresql90/defaultdb".
I am assuming that above message is just a warning as I already have data there. So, now I am trying to start the db
$sudo su postgres -c '/opt/local/lib/postgresql90/bin/pg_ctl start -D /Volumes/bigdrive/Data/db/postgresql90/defaultdb -l ~/Logs/postgresql90-server/main.log'
pg_ctl: could not open PID file "/Volumes/bigdrive/Data/db/postgresql90/defaultdb/postmaster.pid": Permission denied
So, I am kinda stuck. As you can see from the listing below, I seem to have the correct permissions and ownerships
drwxr-xr-x 3 root admin 102 Sep 13 07:42 postgresql90/
punkish at puter /Volumes/bigdrive/Data/db$cd postgresql90/
punkish at puter /Volumes/bigdrive/Data/db/postgresql90$ll
drwx------ 18 postgres postgres 612 Sep 13 07:43 defaultdb/
punkish at puter /Volumes/bigdrive/Data/db/postgresql90$
More information about the macports-users