How to build mysql driver with mingw on windows ?



  • I need a connect to MySQL by Qt5.1.1 on Windows today.
    In the help of Qt5.1.1, there are contents for "How to build the MySQL driver for MinGW users " and "How to Build the QMYSQL Plugin on Windows" just for Qt4.6.2.

    It says,

    1. go to %MySQL_PATH%\lib\opt, and run commands :

      reimp -d libmysql.lib

      dlltool -k -d libmysql.def -l libmysql.a

    1. go to C:\Qt\4.6.2 and run commands:

      configure.exe -debug-and-release -platform win32-g++ -qt-sql-mysql -l mysql -I C:\MySQL\MySQL51\include -L C:\MySQL\MySQL51\lib\opt

      mingw32-make sub-src

    3)go to C:\Qt\4.6.2\src\plugins\sqldrivers\mysql and run command:

      > qmake "INCLUDEPATH+=C:/MySQL/MySQL51/include" "LIBS+=-L. mysql" mysql.pro
    

    But I meet several problems by building MySQL driver for Qt5.1.1.

    1. I succeed in running commands in step1 above and get "libmysql.def" and "libmysql.a"

    2. In step 2, I move to qt path and run the "configure.exe ....", in fact there is no command for configure.exe.
      I search for "configure" in the whole qt folder, and can find nothing.

    3. In step 3, I can only find folder C:\Qt\Qt5.1.1\5.1.1\mingw48_32\plugins\sqldrivers on my pc, there is no "%Qt_PATH%\src\plugins\sqldrivers\mysql" folder.
      So, "mysql.pro" cannot be found also.

    My environment:

    1. qt-windows-opensource-5.1.1-android-x86-win32-offline.exe
    2. mingw-utils-0.3.tar.gz
    3. mingw-5.1.6.exe
    4. mysql-5.5.31-win32.msi

    Does anyone know why? Who can give me a hand~
    Thank you very much! :)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You need to download Qt's sources in order to build the plugin (you don't need to rebuild all of Qt, just the mysql plugin part)

    Happy coding !



  • So glad that you can answer my question.
    Thank you~ : )


  • Lifetime Qt Champion

    You're welcome !

    Since you could go forward, please update the thread title prepending [solved] so other forum users may know a solution has been found :)



  • Hello Guys I’ve Qt 5.2.1 ×86 for Android, I’m using windows 8 64bit. and I don’t know what exactly should I do to make my application that uses MySQL works in Android.
    Note: the Application works fine on desktop.
    Please help


  • Lifetime Qt Champion

    There's no official MySQL package available for that platform. The thing that you can do is to first build mariaDB by hand for Android. IIRC there's a description of that process in the forum or the wiki pages. However, be aware that you should not try to access a database directly from the internet. Use a web service for that.


Log in to reply
 

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