localhost
as a host refers to a TCP connection, which means the auth method is md5
(password required) per your pg_hba.conf
:
# IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
For the peer
method to be taken, you’d need to connect through Unix domain sockets, and since you seem to be using a debian-like OS, that means putting /var/run/postgresql
in the host
field, or nothing at all (it’s the default unless environment variables say otherwise).
EDIT: if using database URIs (supported since Rails-4.1, as announced in http://weblog.rubyonrails.org/2014/4/8/Rails-4-1/), the syntax could be:
- for localhost:
test: "postgresql://localhost/myapp_test"
- for the default Unix socket domain (host field left empty):
test: "postgresql:///myapp_test"
Related Posts:
- Can’t find the ‘libpq-fe.h header when trying to install pg gem
- could not connect to server: No such file or directory (PG::ConnectionBad)
- 400 Bad Request – request header or cookie too large
- Why Puma listen on ‘tcp://localhost:3000’ instead of ‘http://localhost:3000’
- Explain what " means
- Why does Ruby on Rails use http://0.0.0.0:3000 instead of http://localhost:3000?
- ActionController::InvalidAuthenticityToken
- bundle install returns “Could not locate Gemfile”
- ActionController::InvalidAuthenticityToken
- Rails: Why “sudo” command is not recognized?
- Rails: Can’t verify CSRF token authenticity when making a POST request
- Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails
- undefined method `each’ for nil:NilClass… why?
- Bundler: You must use Bundler 2 or greater with this lockfile
- undefined method `each’ for nil:NilClass… why?
- Using Pundit for all-access “super_admin” role
- How to tell if homebrew is installed on Mac OS X
- What is the difference between Rails.cache.clear and rake tmp:cache:clear?
- Unable to install gem – Failed to build gem native extension – cannot load such file — mkmf (LoadError)
- Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
- Cannot load such file — bcrypt_ext
- How do I remove Permission denied @ rb_sysopen – Gem install error?
- warning: constant ::Fixnum is deprecated When generating new model
- curl : (1) Protocol https not supported or disabled in libcurl
- PostgreSQL error: Fatal: role “username” does not exist
- couldn’t find file ‘jquery’ with type ‘application/javascript’
- Passing parameters in rails redirect_to
- Getting: “Migrations are pending; run ‘bin/rake db:migrate RAILS_ENV=development’ to resolve this issue.” after cloning and migrating the project
- How to find out which rails version an existing rails application is built on?
- RubyMine Unit tests – Test Framework quit unexpectedly
- bcrypt LoadError: Cannot load such file
- Uninitialized constant “Controller Name”
- How do I format datetime in rails?
- heroku open – no app specified
- Difference between rake db:migrate db:reset and db:schema:load
- TypeError: no implicit conversion of Symbol into Integer
- Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets
- GROUP BY and COUNT using ActiveRecord
- How to stop (and restart) the Rails Server?
- Migrations are pending; run ‘bin/rake db:migrate RAILS_ENV=development’ to resolve this issue
- Authentication versus Authorization
- What is an Endpoint?
- Git push results in “Authentication Failed”
- Git push results in “Authentication Failed”
- Advanced AREL or just Rails Query for has_many through search by association
- PostgreSQL: Show tables in PostgreSQL
- What is this JavaScript “require”?
- What is this JavaScript “require”?
- Change GitHub Account username
- PostgreSQL “DESCRIBE TABLE”
- Psql could not connect to server: No such file or directory, 5432 error?
- AngularJS- Login and Authentication in each route and controller
- How to UPSERT (MERGE, INSERT … ON DUPLICATE UPDATE) in PostgreSQL?
- Rails 5 ActionController::InvalidAuthenticityToken error
- How to restart Postgresql
- what does ? ? mean in ruby
- Google OAuth 2 authorization – Error: redirect_uri_mismatch
- Git push results in “Authentication Failed”
- nodejs – error self signed certificate in certificate chain
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- What are the main differences between JWT and OAuth authentication?
- What is the format for the PostgreSQL connection string / URL?
- What is the default password for Postgres
- “use database_name” command in PostgreSQL
- Postgresql 9.2 pg_dump version mismatch
- PSQLException: current transaction is aborted, commands ignored until end of transaction block
- psql: FATAL: Ident authentication failed for user “postgres”
- What ports need to be open for TortoiseSVN to authenticate (clear text) and commit?
- Parsing XML with Ruby
- fe_sendauth: no password supplied
- missing FROM-clause entry for table
- How can I drop all the tables in a PostgreSQL database?
- How to restart PostgreSQL in Ubuntu 18.04
- FATAL: password authentication failed for user “postgres” (postgresql 11 with pgAdmin 4)
- PostgreSQL: Remotely connecting to Postgres instance using psql command
- Simple Random Samples from a Sql database
- Insert text with single quotes in PostgreSQL
- ERROR: there is no unique constraint matching given keys for referenced table “bar”
- Postgresql: Scripting psql execution with password
- Cannot simply use PostgreSQL table name (“relation does not exist”)
- Email validation in Ruby on Rails?
- How do I remove documents using Node.js Mongoose?
- postgresql duplicate key violates unique constraint
- “psql: could not connect to server: Connection refused” Error when connecting to remote database
- Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?
- How to change PostgreSQL user password?
- Postgresql tables exists, but getting “relation does not exist” when querying
- No function matches the given name and argument types
- “extra data after last expected column” while trying to import a csv file into postgresql
- postgresql: error duplicate key value violates unique constraint
- extconf failed, exit code 1 error when installing [Ruby on Rails] 5 on OS X Yosemite 10.10.5
- Rails 4 RoutingError: No Route Matches
- psql: command not found Mac
- pg_ctl: no database directory specified and environment variable PGDATA unset
- psql: FATAL: role “postgres” does not exist
- Postgres Error: More than one row returned by a subquery used as an expression
- PostgreSQL: Query has no destination for result data
- How to change PostgreSQL user password?
- How to exit from PostgreSQL command line utility: psql
- PG::ConnectionBad – could not connect to server: Connection refused