简体   繁体   English

如何在Laravel Homestead中使用postgreSQL

[英]How to use postgreSQL in Laravel Homestead

I can do migration to my homestead. 我可以迁移到我的家园。 this is my .env 这是我的.env

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

And I make a new server in my postgreSQL with 我在postgreSQL中创建了一个新的服务器

server name = Homestead,  
username = homestead,  
password = secret.  

then, I did migration and all the table created into my database( server=homestead ) 然后,我做了迁移,并将所有表创建到我的数据库中( server = homestead
The problem is, when I want to do login in my site. 问题是,当我想在我的网站上登录时。 It occurs an error: 它发生错误:

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

You have an extra 0 at the end of your port. 您的端口末尾有一个额外的0。 Change DB_PORT=54320 to DB_PORT=5432 DB_PORT=54320更改为DB_PORT=5432

try to access your homestead with ssh. 尝试用ssh访问你的家园。

i think u already change the password from the inside 我想你已经从内部更改了密码

from laravel documentation i think that config should work 从laravel文档我认为配置应该工作

or try this command after u change the config 或者在更改配置后尝试此命令

php artisan config:cache and php artisan cache:clear php artisan config:cachephp artisan cache:clear

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM