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

I DON'T KNOW IF THISIS 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/postgresql83/bin/pg_dumpall -U postgres >> /backups/pgsql/databases/2009.07.14_22.58.33/main_db.sql"


ASSUMING WE ARE ALL DONE INSTALLING postgresql83

( 1 ) [2009.11.07](11:07AM) -> [roscoe] ~ $ sudo launchctl load -w / Library/LaunchDaemons/org.macports.postgresql83-server.plist
 ---> Password:

( 2 ) [2009.11.07](12:22PM) -> [roscoe] ~ $ sudo mkdir -p /opt/local/ var/db/postgresql83/defaultdb

( 3 ) [2009.11.07](12:23PM) -> [roscoe] ~ $ sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb

( 4 ) [2009.11.07](12:23PM) -> [roscoe] ~ $ sudo su postgres -c '/opt/ local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/ defaultdb' ---> The files belonging to this database system will be owned by user "postgres".
 ---> This user must also own the server process.

<snip>
 ---> WARNING: enabling "trust" authentication for local connections
---> You can change this by editing pg_hba.conf or using the -A option the
 ---> next time you run initdb.

 ---> Success. You can now start the database server using:

/opt/local/lib/postgresql83/bin/postgres -D /opt/local/var/db/ postgresql83/defaultdb
 ---> or
/opt/local/lib/postgresql83/bin/pg_ctl -D /opt/local/var/db/ postgresql83/defaultdb -l logfile start


Check and see if I have a postgres user ?

( 5 ) [2009.11.07](12:26PM) -> [roscoe] ~ $ dscl . list /users UniqueID | sort -k2 -n | grep postgres
 ---> postgres           505

I had forgotten my postgres password, so...

login as system_root (not sudo) which requires the actual system_root password, and force change the postgres user password

( 6 ) [2009.11.07](02:50PM) -> [roscoe] ~  $ su - root
 ---> Password:

Assign the new postgres password and don't forget it this time...

( 7 ) [2009.11.07](02:50PM) -> [root] ~ $ dscl . -passwd /Users/ postgres <force_assign_a_new_postgres_password>

( 8 ) [2009.11.07](02:50PM) -> [root] ~  $ exit
 ---> logout

Startup PgSQL

( 9 ) [2009.11.07](02:51PM) -> [roscoe] ~ $ /opt/local/etc/ LaunchDaemons/org.macports.postgresql83-server/postgresql83- server.wrapper start
 ---> Password:
 ---> server starting

( 10 ) [2009.11.07](02:51PM) -> [roscoe] ~  $ ps aux | grep postgres
---> roscoe 92842 1.0 0.0 599740 384 s001 S+ 2:52PM 0:00.00 grep postgres ---> root 92561 0.0 0.0 75452 720 ?? Ss 12:22PM 0:00.00 /opt/local/bin/daemondo
 ---> --label=postgresql83-server
---> --start-cmd /opt/local/etc/LaunchDaemons/ org.macports.postgresql83-server/postgresql83-server.wrapper start ; ---> --stop-cmd /opt/local/etc/LaunchDaemons/ org.macports.postgresql83-server/postgresql83-server.wrapper stop ; ---> --restart-cmd /opt/local/etc/LaunchDaemons/ org.macports.postgresql83-server/postgresql83-server.wrapper restart ;
 ---> --pid=none
---> postgres 92840 0.0 0.1 88612 2204 ?? SNs 2:51PM 0:00.12 /System/Library/Frameworks/CoreServices.framework/Frameworks/ Metadata.framework/Versions/A/Support/mdworker MDSImporterWorker com.apple.Spotlight.ImporterWorker.505 ---> postgres 92837 0.0 0.0 599796 460 ?? Ss 2:51PM 0:00.00 /sbin/launchd ---> postgres 92834 0.0 0.0 608916 308 ?? Ss 2:51PM 0:00.00 postgres: stats collector process ---> postgres 92833 0.0 0.0 612852 484 ?? Ss 2:51PM 0:00.00 postgres: autovacuum launcher process ---> postgres 92832 0.0 0.0 612852 424 ?? Ss 2:51PM 0:00.00 postgres: wal writer process ---> postgres 92831 0.0 0.0 612852 468 ?? Ss 2:51PM 0:00.00 postgres: writer process ---> postgres 92827 0.0 0.0 612852 2036 s001 S 2:51PM 0:00.20 /opt/local/lib/postgresql83/bin/postgres -D /opt/local/var/db/ postgresql83/defaultdb

( 11 ) [2009.11.07](02:52PM) -> [roscoe] ~  $


If you still can't get it working try :

( 12 ) [2009.11.07](02:52PM) -> [roscoe] ~ $/opt/local/etc/ LaunchDaemons/org.macports.postgresql83-server/postgresql83- server.wrapper stop ;

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

( 13 ) [2009.11.07](12:22PM) -> [roscoe] ~ $ sudo rm -R /opt/local/ var/db/postgresql83/defaultdb

 NOW GO BACK TO STEP ( 2 ) THROUGH ( 10 ) AGAIN

TO SHUTDOWN EVERYTHING :
$ sudo echo
$ sudo launchctl unload -w /Library/LaunchDaemons/ org.macports.slapd.plist; \ sudo launchctl unload -w /Library/LaunchDaemons/ org.macports.apache2.plist; \ sudo launchctl unload -w /Library/LaunchDaemons/ org.macports.mysql5.plist; \ sudo launchctl unload -w /Library/LaunchDaemons/ org.macports.postgresql83-server.plist


TO RELAUNCH EVERYTHING
$ sudo echo
$ sudo launchctl load -w /Library/LaunchDaemons/ org.macports.slapd.plist; \ sudo launchctl load -w /Library/LaunchDaemons/ org.macports.apache2.plist; \ sudo launchctl load -w /Library/LaunchDaemons/ org.macports.mysql5.plist; \ sudo launchctl load -w /Library/LaunchDaemons/ org.macports.postgresql83-server.plist

_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users

Reply via email to