Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: no PostgreSQL user name specified in startup packet

I'm rocking a Phoenix app, and when I try to run mix ecto.migrate, I encounter the following error:

GenServer #PID<0.181.0> terminating
** (Postgrex.Error) FATAL (invalid_authorization_specification): no PostgreSQL user name specified in startup packet
    (db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol

There's some Q&A out there that touches on this particular error, but I haven't found them to be useful, unfortunately. So I turn here!

Additional environment info: Mac OS X, Postgres.app, PG version 9.5

like image 374
keruilin Avatar asked Sep 02 '16 03:09

keruilin


2 Answers

The StartupMessage sent from the client to the server must contain a non-empty user name; as the documentation says:

StartupMessage (F)

[...]

The protocol version number is followed by one or more pairs of parameter name and value strings. A zero byte is required as a terminator after the last name/value pair. Parameters can appear in any order. user is required, others are optional. [...]

My guess is that you specified an empty user name.

like image 55
Laurenz Albe Avatar answered Oct 05 '22 19:10

Laurenz Albe


if you did not create a new user, the default is your mac username and password.

This is coming late but I hope it helps someone.

like image 22
Abdul-Hammid Avatar answered Oct 05 '22 19:10

Abdul-Hammid