Alexandre1972

Alexandre1972

Hi!

I’m new here.

I was reading this page:

https://hexdocs.pm/phoenix/up_and_running.html

And then, when I tried to run it, I’ve got this message:

19:26:35.127 [error] GenServer pid<0.259.0> terminating
** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user “postgres”
(db_connection 2.3.0) lib/db_connection/connection.ex:99: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn’t be created: killed

===

Does anybody know how can I fix?

Thank you for any help.

Alexandre.

phoenix mix #ecto.create

Showing Posts 1 to 10

Loopers97

Loopers97

I’m assuming you’re on windows, Go into Program Files/PostgreSQL/12/data . Find and open the pg_hba.conf . Scroll to the bottom, and change the row with 127.0.0.1/32. Change the method from md5 to trust. Obviously, don’t do this on a production setup.

Alexandre1972

Alexandre1972 OP

Loopers97, hi!

Thank you so much for your answer to my problem!

My O. S. is Debian Unstable/Sid (a Linux distro).

I’ve searched for this file using this command:

psql -t -P format=unaligned -c ‘show hba_file’

I saw this tip in the following website:

https://askubuntu.com/questions/256534/how-do-i-find-the-path-to-pg-hba-conf-from-the-shell

And then, I found out where it is:

/etc/postgresql/13/main/pg_hba.conf

Well, I made the changes, but I’ve got the same error message:

===

debian@sid:~/hello/hello$ mix ecto.create

23:47:49.715 [error] GenServer pid<0.259.0> terminating
** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user “postgres”
(db_connection 2.3.0) lib/db_connection/connection.ex:99: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn’t be created: killed

===

Alexandre.

Loopers97

Loopers97

I’m assuming you restarted the service after making the config change.

The logs makes it appear like the db is the issue, not ecto if that helps.

Try following this links guide. See if you can log in as postgres and get psql in the terminal. That’ll take ecto out from being a suspect.

https://chartio.com/resources/tutorials/how-to-set-the-default-user-password-in-postgresql/

Alexandre1972

Alexandre1972 OP

Hi again Looper97!

today I made some progress!
I didn’t restarted the service, so, I googled to know how to do this. And then I followed the instructions on this page:
https://avroblog.com/en/blog/content/How-to-restart-PostgreSQL

And now, when I type the “mix ecto.create” command, the error message is different:

===

** (Mix) The database for Hello.Repo couldn’t be created: ERROR 22023 (invalid_parameter_value) encoding “UTF8” does not match locale “en_GB”

The chosen LC_CTYPE setting requires encoding “LATIN1”.

===

I will google again and try to find a solution, then I come back here and post what I found.

Thank you!

Alexandre1972

Alexandre1972 OP

Hi again Loopers97!

Unfortunately, I was not sucessful… I regenerated my locales, using this command:

cd /usr/sbin

./dpkg-reconfigure locales

./locale-gen

But the error messages still are displayed to me:

===

** (Mix) The database for Hello.Repo couldn’t be created: ERROR 22023 (invalid_parameter_value) encoding “UTF8” does not match locale “en_GB”

The chosen LC_CTYPE setting requires encoding “LATIN1”.

===

I still need help …
Have you ever seen this problem before?

Loopers97

Loopers97

Progress is good. You’re dangerously close to getting postgres beat. The locale would have been set on the installation of postgres. I’m not sure what postgres locale defaults to. I’d recommend going digging into etc/lang.

Type locale and dump the output. I’m wondering if they’re all en_US.UTF-8

Loopers97

Loopers97

Here are the official docs for locale

tl;dr
The values that are chosen by initdb are actually only written into the configuration file postgresql.conf to serve as defaults when the server is started. If you remove these assignments from postgresql.conf then the server will inherit the settings from its execution environment. (server)

Always have the option to Nuke and pick the locale, now that you have gained some more knowledge.

Alexandre1972

Alexandre1972 OP

Hi again!

I have a lot of news to you!
Let’s go:

1) This is the what I get when I run the command locale:

debian@sid:~$ locale
LANG=en_GB
LANGUAGE=
LC_CTYPE=“en_GB”
LC_NUMERIC=“en_GB”
LC_TIME=“en_GB”
LC_COLLATE=“en_GB”
LC_MONETARY=“en_GB”
LC_MESSAGES=“en_GB”
LC_PAPER=“en_GB”
LC_NAME=“en_GB”
LC_ADDRESS=“en_GB”
LC_TELEPHONE=“en_GB”
LC_MEASUREMENT=“en_GB”
LC_IDENTIFICATION=“en_GB”
LC_ALL=
debian@sid:~$

2) Then I typed these commands in aterm:

root@sid:/usr/sbin# pg_dropcluster --stop 13 main
root@sid:/usr/sbin# pg_createcluster --locale en_GB.UTF-8 --start 13 main
Creating new PostgreSQL cluster 13/main …
/usr/lib/postgresql/13/bin/initdb -D /var/lib/postgresql/13/main --auth-local peer --auth-host md5 --locale en_GB.UTF-8
The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.

The database cluster will be initialized with locale “en_GB.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/13/main … ok
creating subdirectories … ok
selecting dynamic shared memory implementation … posix
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting default time zone … America/Sao_Paulo
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … ok
syncing data to disk … ok

Success. You can now start the database server using:

pg_ctlcluster 13 main start

Ver Cluster Port Status Owner Data directory Log file
13 main 5432 online postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
root@sid:/usr/sbin# pg_ctlcluster 13 main start

3) Then, I tried the mix command again, and guess what? The first error message, I almost died:

debian@sid:~/hello/hello$ mix ecto.create

11:52:57.370 [error] GenServer pid<0.259.0> terminating
** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user “postgres”
(db_connection 2.3.0) lib/db_connection/connection.ex:99: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn’t be created: killed
debian@sid:~/hello/hello$

4) But then, I did what you’ve told, and changed the file called pg_hba.conf with the “trust” value;

5) Then I restarted the postgrsql using the command systemctl restart postgresql in Debian.

6) Then I came back to the “hello” directory and tried to type the “mix ecto.create” again… and then… Finally!!!

7) Everything is fine now!!!

I will try to paste a screenshot of my term in this post:

I couldn’t have done it without your help… Thank you so much for your patience…

Now I will be able to follow the other steps on the tutorial I was reading.

A BIG, BIG Thank you!

A bright and happy week for you and your family!!!

Alexandre.

Loopers97

Loopers97

That’s great news, happy coding.

Windsound

Windsound

Thanks a lot! I have found my PostgreSQL folder and changed which made it working!
My PostgreSQL was installed at a different derive which is surprising to me.

Where Next? Top

Trending in Questions Top

RSP87
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
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
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
velrest
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
samoloth
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
FlyingNoodle
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
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
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
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews