brew tap elastic/tap # Tap elastic brew search elasticsearch # Will show available versions brew install email@example.com # install specific version
brew services start firstname.lastname@example.org
|brew tap homebrew/versions|
|brew cask install java|
|brew search elasticsearch|
|brew install email@example.com|
|brew services start firstname.lastname@example.org|
Fix for following issue:
$ 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"?
pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql
psql -h localhost -p 5432 -U postgres -d mydb < backup.sql
-h is for host.
-p is for port.
-U is for username.
-d is for database.
The connection failed because by default
psql connects over UNIX sockets using
peer authentication, that requires the current UNIX user to have the same user name as
psql. So you will have to create the UNIX user
postgres and then login as
postgres or use
sudo -u postgres psql database-name for accessing the database (and
psql should not ask for a password).
If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using
psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.
But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following