1

i can only find psql command, but can't find any other postgres commands or tools, can anyone tell me how to create database and connect to it using the default postgres shipped with mac lion?

only if it doesn't work ,i dont' want to install another postgres instance.

0

2 Answers 2

1

PostgreSQL will be started by Launchd, if configured so.

Look for /System/Library/LaunchDaemons/org.postgresql.postgres.plist, this is an XML file and you will need to modify some settings there, like listen_address.
Default location for the PGDATA files is /var/pgsql, also found in the plist file above.

Cluster is owned by the _postgres user, so to access the “tools”, you should execute them via the sudo -u _postgres … prefix, like: sudo -u _postgres pg_ctl -D /var/pgsql -w start I highly recommend creating another role with superuser permissions, as _postgres is sharing password with the Administrator account of your Lion.

You can also use the Server Admin tools for Lion to control PostgreSQL and other services:

sudo serveradmin list
# look for postgres in the output
sudo serveradmin fullstatus postgres

sudo serveradmin stop postgres
sudo serveradmin start postgres

Check the version of your PostgreSQL cluster, using: sudo -u _postgres psql -tc "select version()" and refer to the official manuals on how to create the database and setup initial access. Manual for the latest PostgreSQL version can be found here.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks vyegorov, but there's no such file in /System/Library/LaunchDaemons and psql is in /usr/bin/psql
by the way ,i didn't install mac lion server
What sudo serveradmin list reports?
0

If you do not have the software installed, I strongly recommend the Enterprise DB package. It makes installing pretty darn easy.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.