如何在Laravel Homestead中使用postgreSQL

时间:2017-10-05 09:08:21

标签: php postgresql laravel homestead

我可以迁移到我的家园。 这是我的.env

DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=54320
DB_DATABASE=intern
DB_USERNAME=homestead
DB_PASSWORD=secret

我在 postgreSQL 中使用

创建了一个新服务器
server name = Homestead,  
username = homestead,  
password = secret.  

然后,我进行了迁移,并将所有表创建到我的数据库中( server = homestead
问题是,当我想在我的网站上登录时。它发生错误:

SQLSTATE[08006] [7] could not connect to server: Connection refused↵  
Is the server running on host "localhost" (::1) and accepting↵  
TCP/IP connections on port 54320?↵could not connect to server: Connection refused↵  
Is the server running on host "localhost" (127.0.0.1) and accepting↵  
TCP/IP connections on port 54320? (SQL: select * from "users" where "email" = user@gmail.com limit

2 个答案:

答案 0 :(得分:5)

您的端口末尾有一个额外的0。将DB_PORT=54320更改为DB_PORT=5432

答案 1 :(得分:0)

尝试用ssh访问你的家园。

我想你已经从内部更改了密码

从laravel文档

我认为配置应该工作

或在更改配置

后尝试此命令

template <typename T> class InRange { public: constexpr InRange(T min, T max) : min(std::move(min)) , max(std::move(max)) {} constexpr bool operator()(T const& val) const { return (val >= min && val <= max); } private: T min; T max; }; template<class T> constexpr InRange<T> in_range(T min, T max) { return InRange<T>(std::move(min), std::move(max)); } php artisan config:cache

https://laravel.com/docs/5.6/homestead#connecting-to-databases