I am trying to do a MySQL login. The connection.open() is returning false with correct details...

Qt Code:
  1. QSqlDatabase connection = QSqlDatabase::addDatabase("QMYSQL");
  2. connection.setHostName(host);
  3. connection.setUserName(username);
  4. connection.setPassword(password);
  5. connection.setDatabaseName(database);
  6. connection.setPort(3306);
  7.  
  8. if(connection.open())
  9. // Load program...
To copy to clipboard, switch view to plain text mode 

Some help would be great!