I'm making an address book app and my reequipments are to use postgres as a database. Installing and setting up has gone smoothly but for some reason when I go to start the server I get this error message "connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied"
this is my database.yml
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: scafold_development
test:
<<: *default
database: scafold_test
username: scafold
password:
production:
<<: *default
database: scafold_production
username: scafold
password: <%= ENV["SCAFOLD_DATABASE_PASSWORD"] %>
I've tried searching everywhere for my specific problem, but I cannot find a solution. Please help.
CodePudding user response:
you can try this how to connect rails and postgreSQL. this link
CodePudding user response:
Assuming you haven’t actually created your postgresql instance, there are a couple ways you can go about doing so:
My personal go to method is using a docker-compose file and the corresponding docker compose up -d
command to startup the container.
Something like:
# docker-compose.yml
version: "3"
services:
postgres:
image: postgres:14-alpine
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres_db
# path/to/database.yml
<< ENVIRONMENT_TYPE_HERE >>:
url: postgresql://postgres:password@localhost:5432/postgres_db?schema=public&connection_limit=5