diff --git a/db/db_base.cpp b/db/db_base.cpp index c527345671..05bcd44727 100644 --- a/db/db_base.cpp +++ b/db/db_base.cpp @@ -85,10 +85,14 @@ int DB_CONN::open( // CLIENT_FOUND_ROWS means that the # of affected rows for an update // is the # matched by the where, rather than the # actually changed // - mysql = mysql_real_connect( + MYSQL* mysql2 = mysql_real_connect( mysql, host, db_user, dbpassword, db_name, port, 0, CLIENT_FOUND_ROWS ); - if (mysql == 0) return ERR_DB_CANT_CONNECT; + if (mysql2 == 0) { + fprintf(stderr, "mysql_real_connect(): %d: %s\n", mysql_errno(mysql), mysql_error(mysql)); + return ERR_DB_CANT_CONNECT; + } + mysql = mysql2; if (set_opt_after) { bool mbReconnect = 1;