Patoshizzle
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
(db_connection 2.4.1) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
(connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
17:00:32.215 [error] GenServer #PID<0.420.0> terminating
** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
(db_connection 2.4.1) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
(connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
I thought the database creates the default user postgres are created automatically, why would it fail
authentication. The password according to the config files is postgres
Thanks! ![]()
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
silverdr
You need to check what “ROLES” your Postgres installation has available, and possibly create a suitable one. PostgreSQL docs say:
This means it is neither guaranteed for every PostgreSQL installation to have the
postgres“role” nor it is guaranteed for it to have “postgres” as password, even if it exists.Patoshizzle
I have confirmed thru \du that indeed a user postgres exists, i created (i am not sure if actually ecto was the one supposed to create) a database with the same name in the dev.exs in the config directory and logged in using the password postgress and the log in was successful.
I returned to my elixir/phoenix app and run mix ecto.create and the same error “password authentication failed for user postgres”.
Any other hint or solution is welcome.
silverdr
“postgress” or “postgres”? Make sure the spelling is correct.
What environment is that? OS? Showing the config section and the relevant parts of
pg_hba.confcan help too.Yes,
mix ecto.createshould create the database for you.Patoshizzle
OS: debian 10
password: postgres
(spelling mistake was mine)
//==========the pg_hba.conf relevant snippet ========================//
“local” is for Unix domain socket connections only
local all all peer
IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
IPv6 local connections:
host all all ::1/128 scram-sha-256
Allow replication connections from localhost, by a user with the
replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
//=====================================================================//
May be it may help to add i have tried three postgresql databases, i.e v11, v12 and now v14
without success. its been super stressful. I have purged all the others to download v14.
silverdr
Here’s my config that works on a similar (Debian based) system. I am on v12 here but things should work well with earlier versions too. Certainly no need to go v14 (are you sure you didn’t mess anything up with your cluster’s config when mixing the versions?):
Config files/permissions
pg_hba.conf
Example Phoenix app config:
Yes, I have my “system user” there - that’s what I typically do rather than running as “root” / “superuser” in Postgres terminology. But I believe it should work with “superuser” too. Yet - if everything else fails you could try adding your own user (“ROLE”) with appropriate password and privileges. In any case - that works (and always worked) for me flawlessly on a Debian based systems.
Patoshizzle
Actually after downloading v14,i checked etc/postgre/14/main and both
pg_hba.cong and pg_ident.conf could only be accessed by root user.
I had to chmod 777 both.
I accidentally upgraded my OS which broke everything especially when
i realised most programs i had in /opt file where inaccessible only to find
out the upgrade had changed permissions arbitrarily (thats how it seemed
to me) to the /opt file and probably others random directories too.
What is that linux command that shows the permissions of the files in
the path?
The upgrade may have messed the config clusters. Am not an expert i don’t know where
the config clusters are or what am supposed to with them.
You have offered some valuable info, but am not sure what to next. Can i deleted my pg_hba.conf
and replace it with your snippet? What course of action can i take?
Thanks alot
silverdr
what I use is a shell alias for
ls -alFPostgreSQL runs in “clusters”. I’d suggest you familiarise yourself a little with appropriate
pg_*commands. Starting probably withpg_lsclusters:I’d start with checking that the DB cluster is running correctly, possibly verifying log files for potential abnormalities. If nothing suspicious there, I would try to create a new “ROLE” with appropriate privileges (basically
CREATEDBprivilege). Here an extract from my setup used for development:Patoshizzle
1. My permissions dont look too bad..i chmod 777 pg_hba.conf and pg_ident.conf though,
i dont think its an issue..
drwxr-xr-x 2 postgres postgres 4096 Nov 10 16:52 ./
drwxr-xr-x 3 postgres postgres 4096 Nov 10 16:51 ../
-rw-r–r-- 1 postgres postgres 315 Nov 10 16:52 environment
-rw-r–r-- 1 postgres postgres 143 Nov 10 16:52 pg_ctl.conf
-rwxrwxrwx 1 postgres postgres 5002 Nov 10 16:52 pg_hba.conf*
-rwxrwxrwx 1 postgres postgres 1636 Nov 10 16:52 pg_ident.conf*
-rw-r–r-- 1 postgres postgres 28974 Nov 10 16:52 postgresql.conf
-rw-r–r-- 1 postgres postgres 317 Nov 10 16:52 start.conf
2. I already created a user and dbase manually from postgres console…
Role name | Attributes | Member of
-----------±-----------------------------------------------------------±----------
pato | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
Let me learn a little about clusters, may be i will get a solution.
All keep you posted.
Thanks alot
inko
user postgres has no password after installation, so if you want to authenticate as this superuser, you need to
set it.
777 on these two files makes no sense, set it to 700
silverdr
I am so used to always add own, non-superuser “ROLE” that I wouldn’t think of that. BUT - I recall the OP wrote he was able to use the password (from command line I presume) for the postgres user.