得到“用户密码认证失败".但是在pgAdmin 3中 [英] Got "password authentication failed for user" but in pgAdmin 3 its working
问题描述
为什么我可以从pgAdmin 3中打开数据库,但是在laravel上尝试时却无法正常工作?
Why I can open the database from pgAdmin 3 but when I tried it on laravel, it doesn't working?
它给我这个错误
SQLSTATE [08006] [7]严重:用户"khrisna"的密码身份验证失败致命:用户"khrisna"的密码身份验证失败
SQLSTATE[08006] [7] FATAL: password authentication failed for user "khrisna" FATAL: password authentication failed for user "khrisna"
我已经通过添加我自己的postgresql用户尝试了方法
I already tried this method by adding my own postgresql user
这是我的pgAdmin接受我的用户名和密码的证明,我什至添加了新的服务器"以确保我的凭据正确
Here is the proof that my pgAdmin accept my user and password, I even added new "server" to make sure that my credentials are correct
那为什么在幼虫中说错了呢?这是我的.env
文件
So why in the laravel it says it wrong? Here is my .env
file
已编辑
我刚刚意识到,我可以毫无问题地运行php artisan migrate
,那么为什么唯一的问题是访问数据库?我已经撞墙了,不知道该怎么办,甚至不知道我需要在google中键入什么样的关键字才能得到答案.
I just realized, that I can run php artisan migrate
without problems, so why the only problem is to access the database? I already hit the wall and don't know what to do or even I don't know what kind of keywords I need to type into google to get the answer.
推荐答案
我遇到了类似的问题,因为我使用的是Homestead,因此localhost地址指向的是虚拟机,而不是我的计算机.将IP地址更改为MY IP地址有效.否则,只需使用Laravel默认值,其用户名是homestead,密码是秘密.它在虚拟机上作为本地实例访问Postres
I was having a similar problem because I was using Homestead, so the localhost address was pointing to the virtual machine, not my computer. Changing the IP address to MY IP address worked. Or else just use the Laravel default who's user name is homestead and password is secret. It accesses Postres as a local instance on the virtual machine
这篇关于得到“用户密码认证失败".但是在pgAdmin 3中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!