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,
-
go to %MySQL_PATH%\lib\opt, and run commands :
reimp -d libmysql.lib
dlltool -k -d libmysql.def -l libmysql.a
-
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.
-
I succeed in running commands in step1 above and get "libmysql.def" and "libmysql.a"
-
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. -
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:
- qt-windows-opensource-5.1.1-android-x86-win32-offline.exe
- mingw-utils-0.3.tar.gz
- mingw-5.1.6.exe
- mysql-5.5.31-win32.msi
Does anyone know why? Who can give me a hand~
Thank you very much! :) -
-
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 !
-
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 :)
-
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.