Difficulty installing and using PostgreSQL.

Bill Hernandez ms at mac-specialist.com
Fri Jul 17 15:22:58 PDT 2009


On Jul 15, 2009, at 7:39 PM, Don Fox wrote:

>
> I have been attempting to install and use PostgreSQL without  
> success, using MacPorts. I've installed 8.3.7 and 8.4. Installation  
> goes without apparent hitch but then postgreSQL server is not able  
> to be accessed. I've changed the PATH as per the documentation but  
> postgresql is never to be found.
>
> Ive done a number of previous installations via macports without any  
> problems. I'm using an old MacPowerBook with 2gigs of memory running  
> the current Leopard.
>
> Also, I've attempted the installation using zip files from the  
> postgre site and disk imag from PostgreSQL for Mac. Not any luck!
>
> Any suggestions?
>
> Thanks very much,
>
> Don Fox

Don,

Did you try the exact steps I sent you  the other day ? This is short  
set modified for 84...

I have used them many times, and they work. Sometimes during the  
install if things get messed up you can remove the data directory  
(defaultDB) and re-initialize the database and that will get you up  
and running.

These instructions should work for you if you follow them exactly.  
Since you have already installed the database, if you have a backup  
the best course of action would be to start at step ( 8 ).

I DON'T KNOW IF THIS IS A NEW INSTALL, BUT MAKE SURE YOUR DATA IS  
BACKED UP....

YOU SHOULD HAVE DONE SOMETHING LIKE :

$ sudo mkdir -p /backups/pgsql/databases/2009.07.14_22.58.33

$ sudo su - postgres -c "/opt/local/lib/postgresql84/bin/pg_dumpall -U  
postgres >> /backups/pgsql/databases/2009.07.14_22.58.33/main_db.sql"

ASSUMING YOU ARE ALL DONE INSTALLING postgresql84

( 1 ) $ sudo launchctl load -w /Library/LaunchDaemons/ 
org.macports.postgresql84-server.plist
( 2 ) $ sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb
( 3 ) $ sudo chown postgres:postgres /opt/local/var/db/postgresql84/ 
defaultdb
( 4 ) $ sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb - 
D /opt/local/var/db/postgresql84/defaultdb'
( 5 ) $ /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/ 
postgresql84-server.wrapper start
( 6 ) $ ps aux | grep postgres

THESE ARE FOR IMMEDIATE START/STOP
[start-cmd ] ---> $ /opt/local/etc/LaunchDaemons/ 
org.macports.postgresql84-server/postgresql84-server.wrapper start ;
[stop-cmd ] ---> $ /opt/local/etc/LaunchDaemons/ 
org.macports.postgresql84-server/postgresql84-server.wrapper stop ;
[restart-cmd] ---> /opt/local/etc/LaunchDaemons/ 
org.macports.postgresql84-server/postgresql84-server.wrapper restart ;

If you still can't get it working try :

( 7 ) $/opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/ 
postgresql84-server.wrapper stop ;


WARNING : MAKE TRIPLE SURE YOU HAVE YOUR DATA BACKED UP BEFORE THE  
NEXT STEP...

( 8 ) $ sudo rm -R /opt/local/var/db/postgresql84/defaultdb

  NOW GO BACK TO STEP ( 1 ) THROUGH ( 6 ) AGAIN

TO SHUTDOWN  :
$ sudo launchctl unload -w /Library/LaunchDaemons/ 
org.macports.postgresql84-server.plist


TO RELAUNCH
$ sudo launchctl load -w /Library/LaunchDaemons/ 
org.macports.postgresql84-server.plist

Good Luck,

Bill Hernandez
Plano, Texas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20090717/d53eb748/attachment.html>


More information about the macports-users mailing list