diff --git a/server/modules/authenticator/MySQLAuth/mysql_auth.c b/server/modules/authenticator/MySQLAuth/mysql_auth.c index 62ea6bb3c..5422591b3 100644 --- a/server/modules/authenticator/MySQLAuth/mysql_auth.c +++ b/server/modules/authenticator/MySQLAuth/mysql_auth.c @@ -304,15 +304,23 @@ mysql_auth_authenticate(DCB *dcb) } else if (dcb->service->log_auth_warnings) { + // Enough to hold the error message and the database name + char extra[256] = {}; + + if (auth_ret == MXS_AUTH_FAILED_DB) + { + snprintf(extra, sizeof(extra), "Unknown database: %s", client_data->db); + } + if (dcb->path) { - MXS_WARNING("%s: login attempt for user '%s'@[%s]:%s, authentication failed.", - dcb->service->name, client_data->user, dcb->remote, dcb->path); + MXS_WARNING("%s: login attempt for user '%s'@[%s]:%s, authentication failed. %s", + dcb->service->name, client_data->user, dcb->remote, dcb->path, extra); } else { - MXS_WARNING("%s: login attempt for user '%s'@[%s]:%d, authentication failed.", - dcb->service->name, client_data->user, dcb->remote, dcb_get_port(dcb)); + MXS_WARNING("%s: login attempt for user '%s'@[%s]:%d, authentication failed. %s", + dcb->service->name, client_data->user, dcb->remote, dcb_get_port(dcb), extra); } if (is_localhost_address(&dcb->ip) &&