我们只需要根据 config 文件夹中的文件使用this db method创建一个新的postgresql username 和 password
$ sudo -u postgres createuser <username>
$ sudo -u postgres createdb <dbname>
$ sudo -u postgres psql
psql=# alter user <username> with encrypted password '<password>';
psql=# grant all privileges on database <dbname> to <username> ;
1
我需要更新pg_hba.conf以使其工作 .
我正在使用Fedora,所以转到/ var / lib / pgsql / data
# "local" is for Unix domain socket connections only
local all postgres peer
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 ident
4 回答
我假设
mix ecto.create
任务发生了这个错误?发生这种情况是因为Ecto使用
psql
来创建数据库,但是在即将到来的Ecto 2.0中不再是这种情况 .以下GitHub问题显示相同的问题https://github.com/elixir-lang/ecto/issues/1207
修复的相关评论是https://github.com/elixir-lang/ecto/issues/1207#issuecomment-172570064:
请检查
pg_hba.conf
(可能在/etc/postsgresql/9.x/pg_hba.conf
) .我使用Ubuntu 14.04得到了同样的错误,我纠正了重置'postgres'密码:
并重新启动postgres服务:
我们只需要根据
config
文件夹中的文件使用this db method创建一个新的postgresqlusername
和password
我需要更新pg_hba.conf以使其工作 .
我正在使用Fedora,所以转到/ var / lib / pgsql / data
然后我在postgres中创建了一个具有数据库创建功能的elixir用户,并在dev.exs中配置它(用户/密码/数据库)