connect to "localhost" fails when libmysqlclient db-plugin is used

Bug #1212064 reported by Vlad Lesin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MOVED - Percona Playback
New
Undecided
Unassigned

Bug Description

Percona-playback uses mysql_real_connect() to connect to server with the following way:

bool MySQLDBThread::connect()
{
  mysql_init(&handle);
  if (!mysql_real_connect(&handle,
                          options->host.c_str(),
                          options->user.c_str(),
                          options->password.c_str(),
                          options->schema.c_str(),
                          options->port,
                          "",
                          CLIENT_MULTI_STATEMENTS))
  {
    fprintf(stderr, "Can't connect to server: %s\n",
            mysql_error(&handle));
    return false;
  }
  return true;
}

If options->host is "localhost" mysql_real_connect() tries to connect to server via unix socket (or other ways to optimize communication on localhost, see documentation). In this case the name of unix socket must me specified in the pre-last argument of mysql_real_connect() which is empty string in the code above.

That is why if --mysql-host command line option is "localhost" percona-playback can not connect to server. The workaround is to use 127.0.0.1 instead of "localhost".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.