How to get working Qt mysql driver???

  • Hi everyone.
    I got this error when I run the project:

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

    I've done many things but no positive results. Anyone knows a trick?
    Thanks for reading this.

    P.D. I'm using MacOS

  • Hi
    Your mysql driver not installed on your system.
    Download and install it,then try again

    if you have problem for install it, search on this forum for similar topics. ;)

  • The MySql driver does not come build with your Qt SDK installation for licencing reasons. You will have to build it yourself. There are plenty of topics here on Qt Devnet and elsewhere on the net available on how to do it. You will need to get the Qt sources to do it though, and the MySql SDK.

  • Hi, i successeded to make it work i had explain how in this post, and if it dosen't work just send me a private msg(sorry my english is very bad).

  • OK, thanks! I'm looking it right now. (my english it's worse)
    I'll post results later.

  • Ok, I've done this:

    -> Download Qt sources
    -> Follow this steps :

    But after:
    $qmake "INCLUDEPATH+=/usr/local/mysql/include" "LIBS+=-L/usr/local/mysql/lib -lmysqlclient_r" // Edited to set the real path

    $make // Returns:
    ->make: *** No targets specified and no makefile found. Stop.

    $ls -l output:
    -rwxrwxrwx 1 dunix staff 204 Apr 26 15:46 README
    -rwxrwxrwx 1 dunix staff 2571 Apr 26 15:46 main.cpp
    -rwxrwxrwx 1 dunix staff 122 Apr 26 15:46
    drwxrwxrwx 5 dunix staff 315 Jul 19 16:45 qsqlmysql_debug.xcodeproj

    What should I do now?
    Thanks everyone.

  • I got everything working now. I've compiled the sources following Andre s advice.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.