Reputation: 143
I'm using rails to develop a website but i get this error when i try to open my localhost
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
How to fix it guys
Upvotes: 4
Views: 25697
Reputation: 8388
If you are using postgreql
this issue is due to not starting a server, so you should start the server, one way to do it is to cd
to postgresql
bin
and start it with pg_ctl
, here is an example:
cd "C:\Program Files\PostgreSQL\14\bin"
pg_ctl -D "C:\Program Files\PostgreSQL\14\data" start
Upvotes: 2
Reputation: 83537
If you are running postgres in a docker image, be sure to map the container port to the host. You can do this with docker run -p 5432:5432 <container-name>
or by adding the following to your docker-compose.yml
file:
ports:
- 5342:5342
Upvotes: 0
Reputation: 332
In Windows, search for "services" and search for postgres in the list. Right click and select "Start".
Upvotes: 6
Reputation: 1296
It looks like your postgreql server is not running. You can try to launch it with :
On Linux :
sudo service postgresql start
On windows : changing XX by your postgresql version run :
net start postgresql-XX
You can also stop using postgres and specify a sqlite database in your config/database.yml file :
changing this line :
adapter: postgresql
by this line :
adapter: sqlite3
Upvotes: 1