Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

I have problems with QMYSQL Driver!



  • Hello!

    I know there are many threads for this, but I tried them all, and I failed to install the QMYSQL Driver. Can someone help me via Team Viewer to instal the driver?

    Thanks,
    KaLoo



  • I don't think you find here someone who will do it. Maybe better will be to describe your problem here? Also please double check forum search for your problem, maybe you've missed some threads with your problem (there are a LOT of mysql driver threads here)



  • I succesfully maked the .def and .a library, but when I try to make

    "qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro"

    it says mysql.pro don`t exist. What shoul I do?



  • Do you have a file mysql.pro?



  • I made
    "qmake "INCLUDEPATH+=%mySQLDIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib" -o Makefile mysql.pro" and "mingw32-make", I think it was a success. What should I do next?



  • I am not understanding your command line notation, especially with your "
    If you write a command line in this forum, you should embrace with '@'

    like this sample line
    @
    qmake test.pro
    @
    Just press on quote on my reply in order to see how to do.

    The example given will start qmake with an input file called "test.pro".

    I assume that you try to start qmake with mysql.pro as an input file. If the file does not exist, you do not have an input file. That is the reason why was asking the question.
    So, do you have mysql.pro as an input file?



  • What should you do after building mysql plugin?
    Hm. Maybe use it?



  • Where I did wrong?
    !http://img641.imageshack.us/img641/1700/unledvfc.png!

    I can`t find

    • libqsqlmysql4.a
    • libqsqlmysqld4.a
    • qsqlmysql4.dll
    • qsqlmysqld4.dll


  • [quote author="kaloo" date="1307294661"]
    "qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro"

    it says mysql.pro don`t exist. What shoul I do?
    [/quote]

    your last statement was the reason to ask my question, if mysql.pro exists. I guess you added this file now. Your output does not show the error message anymore. Is that right?



  • Yes, I have mysql.pro now, and there is no output error message, but I can`t find the 4 files...



  • What do you have in your mysql.pro?



  • @QT += core
    QT += sql

    QT -= gui

    TARGET = mysql
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp
    @

    but I`m guessing that must be other things in the file...



  • typically you would have also the following statements @
    INCLUDEPATH ...
    LIBS ...
    @
    I do not know the details of qmake, but possibly you can do as you did.

    Maybe should do a
    @
    mingw32-make clean
    @
    to clean up the directories and retry.
    Unfportunately, I cannot give more or better advice, since I am not using mingw on windows.



  • I need a good tutorial for helping me to make the QMYSQL Driver for Qt 2.2 ( latest version )





  • Yes... I tried... I know how to use google...



  • Sorry, than I cannot help any further.
    Good luck!



  • Thanks for your help.

    At the begin there is no mysql folder, but I made a new project named mysql and put it in the sqldrives. That is what should I do? Or I did it wrong?



  • There is (or at least should be) a mysql.pro file in your Qt sources. If there isn't, you either are not looking hard enough, or you have an incomplete installation of the Qt sources. The former is more likely. Just making up a .pro file yourself is obviously not going to result in a valid project that is going to help you build the drivers.



  • Andre I think I found the mysql.pro through the source files. Ill try tomorrow to make the QMYSQL Driver. If Ill have any problems, I`ll make a reply tomorrow.



  • I found the right mysql.pro, I tiped
    @
    qmake "INCLUDE+=C:..." "LIBS+=C:...\libmysql.a" -o Makefile mysql.pro
    mingw32-make
    @

    then I got !http://img651.imageshack.us/img651/614/unledswx.png!
    Where is the problem?



  • Did you prepare the MySql libs for use with the MinGw compiler, as is described in the countless other topics you claimed to have read on this issue?



  • Yes I did. I crated the libmysql.a



  • @kallo here are the steps to build mysql plug-in driver ( and I assure you it works :-) ):

    1. download mysql-connector-c-noinstall-6.0.2-win32 binary package from mysql downloads.
    2. open %QTDIR%\src\plugins\sqldrivers\mysql\mysql.pro in QtCreator
    3. add LIBS and INCLUDEPATH in mysql.pro to match with your mysql-connector-c-noinstall-6.0.2-win32 path
    4. after mysql.pro is succesfully build, copy the qsqlmysqld4.dll + qsqlmysql4.dll in %QTDIR%\Desktop...etc...\plugins\sqldrivers (there should already be qsqlite4.dll)
    5. copy libmysql.dll in %QTDIR%\Desktop...etc...\bin

    that's all



  • No cincirin, that is not all. It depends on your toolchain. If you use minGw, as kaloo is doing, you need some additional steps.



  • I use mingw toolchain and they work.



  • So I did how cincirin said
    !http://img51.imageshack.us/img51/5876/unledcj.png!

    the output says
    @
    cannot find -libmysql
    @

    Where should libmysql stay? or what I did wrong?



  • Do you have libmysql*.a* ? Don't you have libmysql.lib ?
    Also you have to put only the path to libmysql.lib LIBS += yourPath



  • I have libmysql.a



  • From what I see, you didn't download mysql conector binary builds. Your path is towards xampp/...



  • I have mysql-connector-c-noinstall-6.0.2-win32, extracted in the xampp/mysql folder

    edit:
    if I put
    @
    INCLUDEPATH += C:/xampp/mysql/include
    LIBS += C:/xampp/mysql/lib/libmysql.a@
    before
    @
    include(../../../sql/drivers/mysql/qsql_mysql.pri)
    include(../qsqldriverbase.pri)
    @
    The output gives me 83 errors with undefined reference



  • Ok, then your project should look as: ... LIBS += c:/xampp/mysql/lib
    Anyway, I don't have libmysql*.a*



  • I created the libmysql.a with
    @ reimp C:/xampp/mysql/lib/libmysql.lib @



  • You have to put only the path to mysql lib directory, because qsql_mysql.pri already do: LIBS += -llibmysql
    Did you try with LIBS += -Lc:/xampp/mysql/lib ?



  • the mysql.pro is now:
    @
    TARGET = qsqlmysql

    SOURCES = main.cpp

    INCLUDEPATH += C:/xampp/mysql/include
    LIBS += C:/xampp/mysql/lib

    include(../../../sql/drivers/mysql/qsql_mysql.pri)
    include(../qsqldriverbase.pri)
    @

    and the output sais
    @
    C:/xampp/mysql/lib No such file: Permission Denied
    @

    but the folder is not read only... I don`t know what to do...



  • Your project should be:
    @
    TARGET = qsqlmysql

    SOURCES = main.cpp
    include(../../../sql/drivers/mysql/qsql_mysql.pri)

    include(../qsqldriverbase.pri)

    INCLUDEPATH = C:/xampp/mysql/include
    LIBS += -LC:/xampp/mysql/lib
    @



  • Yes, now is
    @
    TARGET = qsqlmysql

    SOURCES = main.cpp
    include(../../../sql/drivers/mysql/qsql_mysql.pri)

    include(../qsqldriverbase.pri)

    INCLUDEPATH = C:/xampp/mysql/include
    LIBS += -LC:/xampp/mysql/lib
    @
    but again
    @
    cannot find -libmysql
    @

    Where should be that file? in the lib folder of mysql?



  • Yes, libmysql .lib lives in mysql lib directory. You don't have to convert it.



  • In which directory exactly do you try to build the plugin? When looking at your screenshot from below it looks like you try to build it in qtVersion/plugins/sqldrivers/mysql. Is this the case? The directory where you should be building it is not the one in your screenshot, instead you should build it in:

    qtVersion/src/plugins/sqldrivers/mysql

    [quote author="kaloo" date="1307298523"]Where I did wrong?
    !http://img641.imageshack.us/img641/1700/unledvfc.png!

    I can`t find

    • libqsqlmysql4.a
    • libqsqlmysqld4.a
    • qsqlmysql4.dll
    • qsqlmysqld4.dll
      [/quote]


  • sigrid I know that now, but that is one of the old errors. Not I have problems with

    [quote]
    Yes, now is
    @
    TARGET = qsqlmysql

    SOURCES = main.cpp
    include(../../../sql/drivers/mysql/qsql_mysql.pri)

    include(../qsqldriverbase.pri)

    INCLUDEPATH = C:/xampp/mysql/include
    LIBS += -LC:/xampp/mysql/lib
    @
    but again
    @
    cannot find -libmysql
    @
    Where should be that file? in the lib folder of mysql?
    [/quote]


Log in to reply