skip to Main Content

I have successfully installed postgresql, age and age-viewer on my m1 mac. But today it shows connection error

"Database Connection Failed
Failed to connect to the database. Are you sure the database is running on the server?
[]:(ECONNREFUSED) connect ECONNREFUSED 127.0.0.1:5430" 
log file details-
Error: Not connected
    at _callee3$ (/Users/sakibadnan/Desktop/Install/age-viewer/backend/src/controllers/databaseController.js:54:19)
    at tryCatch (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:44:17)
    at Generator.<anonymous> (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:125:22)
    at Generator.next (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:69:21)
    at asyncGeneratorStep (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
    at /Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:7
    at new Promise (<anonymous>)
    at apply (/Users/sakibadnan/Desktop/Install/age-viewer/backend/node_modules/@babel/runtime/helpers/asyncToGenerator.js:19:12)
    at getStatus (/Users/sakibadnan/Desktop/Install/age-viewer/backend/src/controllers/databaseController.js:56:6)
info: ::ffff:127.0.0.1 - - [29/Mar/2023:05:47:09 +0000] "GET /api/v1/db HTTP/1.1" 500 51
 {"timestamp":"2023-03-29 11:47:09"}
info: ::ffff:127.0.0.1 - - [29/Mar/2023:05:47:09 +0000] "GET /api/v1/miscellaneous HTTP/1.1" 304 -
 {"timestamp":"2023-03-29 11:47:09"}
Error: connect ECONNREFUSED 127.0.0.1:5430
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5430
}
info: ::ffff:127.0.0.1 - - [29/Mar/2023:05:47:30 +0000] "POST /api/v1/db/connect HTTP/1.1" 500 85
 {"timestamp":"2023-03-29 11:47:30"}

I have tried to connect database in age-viewer but after successful installation it now refuse to connect although i have changed my port number?

4

Answers


  1. I may add some clarifications (deduced from the question)
    That error is shown on the running terminal which holds the age-viewer project and you have tried through the front-end to connect to your database and it gets that error on the terminal and for sure similar at the front-end page

    There are some tips may help out

    1. Every-time you open your machine you will need to start the server to be able to connect to it
    2. Try to connect through pgsql to make sure the server is running
    3. Stop the process of the server and start it over again
    4. Try you connect again

    Some commands you may need:

    1. server starting
    /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
    
    1. database creation
    /usr/local/pgsql/bin/createdb test
    
    1. test connection
    /usr/local/pgsql/bin/psql test
    
    Login or Signup to reply.
  2. Possible duplicate and this too.

    To me it seems like loopback error.

    Try:

    127.0.0.1 to your address (Use netstat). Port to new port.

    Example:

    DATABASE_URL: postgres://username:[email protected]:5432/mydatabase
    to
    
    DATABASE_URL: postgres://username:[email protected]:19000/mydatabase
    

    You can use netstat to help you:

    netstat -na
    
    Login or Signup to reply.
  3. Restart the server
    create some test database
    then run connection test
    This maybe a cause of loopback adapter.
    Do this

    127.0.0.1 to db_name

    Login or Signup to reply.
  4. As I see you are using port 5430, First verify that the PostgreSQL server is listening on the correct port using this netstat -an | grep 5430 If there is no output, the PostgreSQL server is not listening on port 5430.

    So now you have to check the PostgreSQL server’s configuration in postgresql.conf file. The default port used by PostgreSQL is 5432. If you want to set it to a different value say 5430, update it accordingly. Save the configuration file and restart the PostgreSQL server.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search