Reputation: 21
I work on windows 11 Germ versions `
ruby "2.7.3"
gem "rails", "~> 7.0.7"
gem "pg", "~> 1.1" `
when I try to migrate the db migrations for the first time, it started showing the error
` rails aborted! ActiveRecord::ConnectionNotEstablished: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
Caused by: PG::ConnectionBad: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
`
I tried re-installing pg, I cant find postgresql in services also to restart. I tried changing the port, still it is not working
Upvotes: 0
Views: 1209
Reputation: 214
The problem is that you dont have the postgress installed. The pg gem is just the adapter (communication layer) between your project and postgress. You need to install and setup the postgress separately and for that there is a lot of tutorials in google. ChatGPT also can provide a lot of helpfull instructions on postgres instalation. Here is the basic steps you should fulfill:
Upvotes: 1