|
The C connector generates and sends an invalid auth packet when passing the CLIENT_CONNECT_WITH_DB flag but not actually passing a DB string. Doing this may seem non-sensical at first (especially when looking at the simple example below), but in my specific case I'm using a wrapper library around libmysqlclient which is always setting the flag, no matter if you actually want a database or not.
Debugging this cost me several hours. It could make sense for my_auth.c to clear the respective flag bit if db is NULL instead of sending a faulty packet.
MYSQL *my = mysql_init(NULL);
|
if (mysql_real_connect(my, "localhost", "root", "foo", NULL, 3306, NULL, CLIENT_CONNECT_WITH_DB)) {
|
printf("SUCCESS\n");
|
} else {
|
printf("%d\n", mysql_errno(my));
|
}
|
|