fe_sendauth:postgresql + laravel中没有提供密码错误 [英] fe_sendauth: no password supplied error in postgresql + laravel
问题描述
我正在尝试在Laravel应用程序中运行数据库迁移.但是,我不断收到错误消息:
I am trying to run database migrations in a Laravel application. However, I keep getting the error:
[PDOException]
SQLSTATE[08006] [7] fe_sendauth: no password supplied
经过一番研究,我在最后一行(以下)中添加了一个条目,从而编辑了pg_hba.conf文件.然后,我重新加载了数据库的配置设置:
After some research, I edited my pg_hba.conf file by adding an entry in the last line (below). I then reloaded the database's config settings:
SELECT pg_reload_conf();
我尝试再次运行迁移,但是仍然出现相同的未提供密码
错误.有人可以帮忙吗?预先感谢!
I tried to run the migration again but I am still getting the same no password supplied
error. Can someone help? Thanks in advance!
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication user trust
#host replication user 127.0.0.1/32 trust
#host replication user ::1/128 trust
host all all 127.0.0.1/32 trust <--- this is my entry
推荐答案
我遇到了这个问题-以某种方式设置了全局环境变量DB_PASSWORD,该变量优先于.env文件中设置的DB_PASSWORD.全局环境变量设置为空,因此系统没有说谎-我确实没有传递密码:)我通过运行以下命令来解决此问题:
I had this issue -- somehow I had set a global environment variable DB_PASSWORD that was taking precedence over my DB_PASSWORD as set in my .env file. That global environment variable was set to empty, thus the system wasn't lying -- I really was not passing a password :) I fixed this by running the following command:
取消设置DB_PASSWORD
unset DB_PASSWORD
那一切都很好.
这篇关于fe_sendauth:postgresql + laravel中没有提供密码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!