How to start postgreSQL server on mac os x?
|
383
311
|
FINAL UPDATE: I forgot to run the initdb command. < /FINAL UPDATE> by running this command
I see that postgres is not running
this raises the question: How do I start the postgresql server? update:
update 2: The touch was not successful so I did this instead:
But when I try to start rails server, I still see this:
update 3:
update 4: I found that there WAS NO pg_hba.conf (only pg_hba.conf.sample) so I modified the sample and renamed it (to remover the .sample). Here are the contents:
but I don't understand this:
also:
update 5:
update 6: this seems odd:
though, I did do this:
so I did this:
so I tried this:
still getting the same "Is the server running?" message. |
||||||||||||||||||||
|
|
791
+50
|
The Homebrew package manager includes launchctl plists to start automatically. For more information run Start manually:
Stop manually:
What is the result of What is the result of Are there any error messages in the server.log? Make sure tcp localhost connections are enabled in pg_hba.conf:
Check the listen_addresses and port in postgresql.conf:
Cleaning up Postgres was most likely installed via Homebrew, Fink, MacPorts or the EnterpriseDB installer. Check the output of the following commands to determine which package manager it was installed with:
|
||||||||||||||||||||
|
|
127
|
I had almost the exact same issue, and you cited the initdb command as being the fix. This was also the solution for me, but I didn't see that anyone posted it here, so for those who are looking for it:
|
||||||||||||||||
|
|
53
|
Another approach is using lunchy gem.
To start postgres:
To stop postgres:
For further info refer to: "How to Install PostgreSQL on a Mac With Homebrew and Lunchy" |
|||
|
31
|
If you want to manually start and stop postgresql (installed via homebrew), the easiest way is:
and
|
||||||||||||||||||||
|
|
30
|
Here my 2 cents: I made a alias for postgres pg_ctl and put it in .bash_profile(my postgresql version is 9.2.4, and database path is /Library/PostgreSQL/9.2/data).
Launch new terminal. And then? You can start/stop your postgresql server with this:
|
||||||||||||
|
|
17
|
To start the postgresql server:
to end the postgresql server:
You can also create an alias via CLI to make it easier:
With these you can just type "pg-start" to start Postgres and "pg-stop" to shut it down. |
|||
|
13
|
For test purposes, i think PostgreSQL App is the best option! Run an App, and the server is up and running. Close the App, and the server goes down. |
||||
|
|
9
|
The cleanest way by far to start/stop/restart postgres if you have installed it through
The first line will stop postgres and the second line will start it. No need to specify any data directories etc. since everything is in that file. |
||||
|
|
5
|
when you install postgresql using homebrew:
at the end of the output you will see this methods to start server:
I think this is the best way. You can add alias into your .profile for convenience. |
|||
|
3
|
PostgreSQL is integrated in Server.app available through the App Store in Mountain Lion. That means that it is already configured, and you only need to launch it, and then create users and databases. Tip: Do not start with defining $PGDATA and so on, take file locations as is. You would have this file: /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist To start:
Process started with arguments: /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -D /Library/Server/PostgreSQL/Data -c listen_addresses=127.0.0.1,::1 -c log_connections=on -c log_directory=/Library/Logs/PostgreSQL -c log_filename=PostgreSQL.log -c log_line_prefix=%t -c log_lock_waits=on -c log_statement=ddl -c logging_collector=on -c unix_socket_directory=/private/var/pgsql_socket -c unix_socket_group=_postgres -c unix_socket_permissions=0770 You can sudo:
Or connect:
You can find the data directory, version, running status and so forth with
|
||||||||||||
|
|
3
|
For a quick disposable test database you can run the server in the foreground. Initialize a new postgres database in a new directory
Start the server in the foreground (ctrl-C to stop the server)
In another shell session, connect to the server
|
|||
|
1
|
For development purposes, one of the simplest ways is to install Postgres.app from the official site. It can be started/stopped from Applications folder or using the following commands in terminal:
|
||||
|
|
1
|
Variation on this answer: http://stackoverflow.com/a/13103603/2394728
|
||||||||||||
|
Your Answer
Post as a guest
|
Name
Email
|
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged osx postgresql or ask your own question.
| Technology | Life / Arts | Culture / Recreation | Science | Other | ||
|---|---|---|---|---|---|---|