title: How to connect a QSqlDatabase using TCP? (Qt's MySQL Driver)
body: <p>I am trying to connect to a local MySQL server, but cannot find out how to select if QSqlDatabase should connect through a socket or port. Qt is version 4.6.3. My simple test code is as follows:</p>
  
  <pre><code>QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
  db.setHostName("localhost");
  db.setPort(3306);
  db.setDatabaseName("rem");
  db.setUserName("test");
  db.setPassword("test");
  
  if (!db.open()) {
      qDebug() &lt;&lt; db.lastError();
  }
  </code></pre>
  
  <p>This gives me:</p>
  
  <pre><code>QSqlError(2002, "QMYSQL: Unable to connect",
      "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")
  </code></pre>
  
  <p>As you can see it wants to connect using the default socket, which I don't want.</p>
  
  <p>I found <code>db.setConnectOptions("UNIX_SOCKET=blabla")</code>, with which you can set the socket. Unfortunately I cannot figure out how to <em>unset</em> it.</p>