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
- Git push results in “Authentication Failed”
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- What is the default password for Postgres
- Parsing XML with Ruby
- fe_sendauth: no password supplied
- Email validation in Ruby on Rails?
- Ruby: What is the easiest way to remove the first element from an array?
- PostgreSQL create table if not exists
- eroku “psql: FATAL: remaining connection slots are reserved for non-replication superuser connections”
- java.lang.ClassNotFoundException: org.postgresql.Driver, Android
- An unhandled lowlevel error occurred. The application logs may have details
- Uploading a file in Rails
- How to bypass (deprecated) reCAPTCHA V1?
- How do I require authorization / login to view a specific set of posts / pages?
- What is $interim_login?
- Set up WP Authentication from External API
- Login members using web services
- how to authenticate for the REST API from a plugin and from command line
- Keep Users Logged In As Long As I Like
- Authentication / login mechanism (non wp-admin)
- FTP Username and password wrong while installing theme
- Security error WP 4.0 + WP phpBB Bridge [closed]
- add action which returns modified value
- How to login to WordPress site using basic authentication HTTP headers?
- Rest API authentication issue when called from fetch request in bundle.js
- Validate Custom Login field
- Best Way to Enable Two Step Authentication
- WP-API and Basic Auth returning 403 on POST but not GET
- Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?
- How to extend expiry time of jwt wordpress token?
- Single sign-on: wp_authenticate_user vs wp_authenticate
- Rest API code to get ID of current user not working: get_current_user_id() gives 0
- After logout browser’s back button into twenty sixteen theme profile
- WordPress Login Customization for External Authentication
- Auto log in hook is requiring a page refresh
- Getting 401 from ajax using an application password
- How to connect android app with WordPress website?
- WordPress REST API calls that depend on the WordPress User
- WooCommerce OAuth 1.0 + JWT authentication with JS/React
- Authenticating users with usermeta fields
- Allow Access to Home Page and Login Screen but Nothing Else (unless logged in)
- Reloading page with a query string upon login for admins
- How can LDAP/Active Directory be integrated in WordPress?
- Multiple issues with Ajax login function due to browsers and cookies
- Working Around rest_forbidden_context
- Use WP cookie to authentificate user on an external app
- Open authenticed WordPress page from mobile app
- Basic Auth .htaccess on wp-login, but allow logout from woocommerce
- how to add security questions on wp-registration page and validate it
- Can we start session from another php site to wordpress blog site?
- After cloning my WordPress database to another server, I cannot log in
- Cookie is not set
- Use WordPress engine for user registration and management
- Advice on setting up private site
- WordPress Multisite and site speed and scaleability
- Blocking the direct access to images in the upload folder WordPress
- How to force or redirect to SSL in nginx?
- Why is SSH password authentication a security risk?
- WordPress Network / Multisite login to one site allow access to all