MYSQL driver for Mac OS X 10.7
-
Hi
I am a beginner to QT on the Mac and a relative novice to the MacOS. A little help with getting the MySQL driver loaded would be appreciated. I have spent many nights trying to understand how to do just this and I have failed miserably.I have MySQL installed and running no problem. I have installed Qt Creator using a .dmg form http://qt.nokia.com/downloads/ (may be this is where I went wrong )
Qt works fine for simple QT commands.
I have included the following line in my .pro file
@QT += core sql testlib script@My code is something like this :
@
void TestMySqlDatabase::testDataBaseConnection()
{
QSqlDatabase db = connectRoot("");QString dbName = db.databaseName(); QTEST(dbName, "badges");
}
QSqlDatabase TestMySqlDatabase::connectRoot(QString rootPw)
{
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setDatabaseName("badges");
db.setUserName("root");
db.setPassword(rootPw);
if (!db.open())
{
//qDebug() << db.lastError();
qFatal("Failed to connect to database");
}return db;
}
@
And I get back the following errors :@PASS : TestMySqlDatabase::initTestCase()
QWARN : TestMySqlDatabase::testDataBaseConnection() QSqlDatabase: QMYSQL driver not loaded
QWARN : TestMySqlDatabase::testDataBaseConnection() QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
QFATAL : TestMySqlDatabase::testDataBaseConnection() Failed to connect to database
FAIL! : TestMySqlDatabase::testDataBaseConnection() Received a fatal error.@When I have googled this problem I seem to be seeing people say simply build the MySQL plugin
I have searched my QtSDK folders for the MySql driver plugins but don't seem to see them any where. Can anyone please help either by telling me where I went wrong or where I can find the plugins?Thanks in anticipation