Reputation: 63022
After doing brew install postgres
:
brew install postgres
brew link --overwrite postgresql
Postgres is already running:
/~ $brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
But then how do we connect using psql
client?
13:47:28/~ $psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Updates Tried various suggestions.
Try restarting ..
$brew services start postgresql
Service `postgresql` already started, use `brew services restart postgresql` to restart.
14:37:19/fastparquet $brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
14:37:39/fastparquet $psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
14:37:55/fastparquet $
Connect to localhost?
14:37:34/fastparquet $psql -h localhost
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Upvotes: 4
Views: 4488
Reputation: 63022
The link from a_horse_with_no_name
did the trick. Specifically:
initdb -D /usr/local/var/postgres/
(from Homebrew postgres broken )
and then
createdb
(the latter from psql: FATAL: database "<user>" does not exist )
Upvotes: 3