Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. MYSQL driver for Mac OS X 10.7
Forum Updated to NodeBB v4.3 + New Features

MYSQL driver for Mac OS X 10.7

Scheduled Pinned Locked Moved Installation and Deployment
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WolfCub
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved