could not connect to server: Connection refused (0x0000274D/10061)

16,009

Solution 1

In Windows, search for "services" and search for postgres in the list. Right click and select "Start".

Solution 2

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
Share:
16,009
Gary Vlc
Author by

Gary Vlc

Updated on June 14, 2022

Comments

  • Gary Vlc
    Gary Vlc almost 2 years

    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

  • Gary Vlc
    Gary Vlc over 7 years
    Thanks for the reply, the sudo is which folder? and how specify a sqlite database in my database.yml file?
  • Raphayol
    Raphayol over 7 years
    sudo is a part of the command but it is not absolutely sure that you need it. So try : service postgresql start If this failed with something like 'permission denied', you can try : sudo service postgresql start And if you want you can stop using postgres for your database and use sqlite : in your config/database.yml change this line adapter: postgresql into this line : adapter: sqlite
  • Gary Vlc
    Gary Vlc over 7 years
    I tried to write on C:/Users/name>services postgresql start, but it still can't fix the problem :(
  • Raphayol
    Raphayol over 7 years
    On windows : changing XX by your postgresql version run : net start postgresql-XX
  • Gary Vlc
    Gary Vlc over 7 years
    Sorry how do I find my postgresql? I know is psql -V but everytime i typed in CMD, it says it is not recognised as an internal or external command
  • Raphayol
    Raphayol over 7 years
    This app is configured to be used with a postgresql server. Have you already launch this rails application on your computer ? If yes you should remember how do you launch postgresql : maybe with a software like pgAdmin... see this for more details : stackoverflow.com/questions/36629963/… If no maybe you have to install it