dsyk33753 2019-02-03 05:11
浏览 125

Bd Postgres与Laravel有联系吗?

I had a problem that I could not solve a few days ago, I try to connect with my Postgres bd which is on a server, I work with laravel but it has highlighted an error when I connect to my Postgres bd, this error appears

PDOException in Connector.php line 55: SQLSTATE[08006] [7] 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?

error image:

enter image description here

I would like to know if it has happened the same and how to solve it, Thanks!

  • 写回答

2条回答 默认 最新

  • doudou348131346 2019-02-03 05:24
    关注

    Hard to tell without your environment file. This error might occur because you are already connecting to postgres,

    To check, make sure this line is in your .env file:

    DB_PORT=5432
    

    Or, you can remove the line from the .env and let Laravel choose the default according to the connection:

    'port' => env('DB_PORT', '5432'),
    

    Another cause for failed connection due to auth is that the env file is looking for 127.0.0.1. Sometimes changing this to localhost will help.

    评论

报告相同问题?