Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ecto Postgres install error password authentication failed

I created a phoenix project from the hello example using digital ocean. I entered the username and password from the etc/motd.tail file. I keep getting the error message below. I am a beginner and for some reason I just cannot get ecto to install correctly.

** (Mix) The database for Hello.Repo couldn't be created, reason given: psql: FATAL: password authentication failed for user "elixir" FATAL: password authentication failed for user "elixir"

You can use the following Postgress database credentials: * User: elixir * Pass: ***

install. Any help would be appreciated.

like image 773
Robert Kass Avatar asked Mar 04 '16 00:03

Robert Kass


People also ask

How do I fix Postgres password authentication failed?

Restart the PostgreSQL service from the Services control panel ( start->run->services. msc ) Connect using psql or pgAdmin4 or whatever you prefer. Run ALTER USER postgres PASSWORD 'fooBarEatsBarFoodBareFoot'

What is the default username and password for PostgreSQL?

For most systems, the default Postgres user is postgres and a password is not required for authentication.

What is scram authentication Postgres?

SCRAM supports storing passwords on the server in a cryptographically hashed form which provides advanced security. To access the PostgreSQL database server using SCRAM method of authentication, your client libraries need to support SCRAM. Refer to the list of drivers that support SCRAM.


2 Answers

I get the same error using Ubuntu 14.04 and I corrected resetting the 'postgres' password:

$ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" 

and restart postgres service:

sudo service postgresql restart 
like image 189
3 revs, 2 users 80% Avatar answered Oct 10 '22 03:10

3 revs, 2 users 80%


I assume this error is happening on the mix ecto.create task?

This happens because Ecto uses psql to create the database, however this is no longer the case in the upcoming Ecto 2.0.

The following GitHub issue shows the same issue https://github.com/elixir-lang/ecto/issues/1207

The relevant comment with the fix is https://github.com/elixir-lang/ecto/issues/1207#issuecomment-172570064:

My database config (pg_hba.conf) was apparently wrong.

For anyone else encountering this:

host all my_user 127.0.0.1/32 trust will not work host all my_user localhost trust will work

Please check your pg_hba.conf (likely in /etc/postsgresql/9.x/pg_hba.conf).

like image 45
Gazler Avatar answered Oct 10 '22 05:10

Gazler