Couldn't connect to database when user don't have password.
Opened this issue · 4 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Create user with blank password on MySql server.
2. Try to connect to server (executing mysql_conn:start) as this new user.
It must return {ok, ConnPid}, but instead it returns {error,login_failed}.
Revision 31, Window XP, Erlang R11B, MySql 5.0
Original issue reported on code.google.com by mkur...@gmail.com
on 18 Jun 2007 at 8:10
GoogleCodeExporter commented
Same problem returns:
=ERROR REPORT==== 13-Sep-2007::23:34:45 ===
Error in process <0.81.0> with exit value:
{undef,[{mysql_recv,start_link,["localhost",3306,#Fun<mysql.0.84456779>,<0.81.0>
]},{mysql_conn,init,8}]}
mysql:465: failed starting first MySQL connection handler, exiting
** exited: {error,"timed out"} **
Original comment by orton.n...@gmail.com
on 14 Sep 2007 at 3:39
GoogleCodeExporter commented
+1
Original comment by lgast...@gmail.com
on 17 Dec 2007 at 7:28
GoogleCodeExporter commented
Here's a simple fix that works for me on Mysql 5.0. Should actually work on 4.1
or greater. Make the following change around line
175 in mysql_auth.erl. Basically updating password_new/2
password_new(Password, Salt) ->
%% Check for blank password
case length(Password) of
0 ->
<<>>;
_ ->
Stage1 = crypto:sha(Password),
Stage2 = crypto:sha(Stage1),
Res = crypto:sha_final(
crypto:sha_update(
crypto:sha_update(crypto:sha_init(), Salt),
Stage2)
),
bxor_binary(Res, Stage1)
end.
Dave
http://weblog.miceda.org
Original comment by debry...@gmail.com
on 6 May 2008 at 2:46
GoogleCodeExporter commented
Alternatively, adding another header does the same thing without touching any
existing code:
174a175,176
> password_new([], _Salt) ->
> <<>>;
This patch is utterly trivial - is there some reason it hasn't been applied?
Original comment by g%rre.tt@gtempaccount.com
on 18 Jan 2010 at 10:14