[英]Cannot start a server on Rails with PostgreSQL
I'm making an address book app and my reequipments are to use postgres as a database.我正在制作一个地址簿应用程序,我的装备是使用 postgres 作为数据库。 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"
安装和设置进展顺利,但由于某种原因,当我 go 启动服务器时,我收到此错误消息“连接到位于“localhost”(:: 1)的服务器,端口 5432 失败:fe_sendauth:未提供密码”
this is my database.yml这是我的 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.
请帮忙。
Assuming you haven't actually created your postgresql instance, there are a couple ways you can go about doing so:假设您还没有实际创建您的 postgresql 实例,您可以通过以下几种方法 go 进行创建:
My personal go to method is using a docker-compose file and the corresponding docker compose up -d
command to startup the container.我个人的 go 方法是使用 docker-compose 文件和相应的
docker compose up -d
命令来启动容器。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.