QSqlDatabase::lastError() and the console output from the program will probably tell you exactly what the problem is.
Fearu is correct about the absence of a Qt MySQL plugin in the shipped Qt SDK on Windows. Most Linux builds will have it, but I don't know if the shipped SDK bundle does.
Bookmarks