This is how to enable hash_password() for empty passwords:
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2341,7 +2341,7 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user,
res= ER_NOT_VALID_PASSWORD;
goto end;
}
- if (pwtext.length)
+ if (!auth->auth_string.length)
{
if (info->hash_password)
{
@@ -2356,7 +2356,7 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user,
auth->auth_string.str= (char*)memdup_root(&acl_memroot, buf, len+1);
auth->auth_string.length= len;
}
- else
+ else if (pwtext.length)
{
res= ER_SET_PASSWORD_AUTH_PLUGIN;
goto end;
Indeed. Fixing it this way resolves all the problems.