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 Problems (Solved it)
Forum Updated to NodeBB v4.3 + New Features

MySQL Driver Problems (Solved it)

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 3.3k 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.
  • D Offline
    D Offline
    dukaim
    wrote on last edited by
    #1

    Hello, I've been trying to install the mySQL driver (Windows 7) and its been a headache. It was so easy to install in Ubuntu :(

    Anyways, after using this "guide":http://www.pikopong.com/blog/2010/04/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/

    The commands for the QT Command Propmt "worked" but when I test the drivers in my application I only get
    @int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    qDebug() << QSqlDatabase::drivers();
    return a.exec();
    }@

    @<"QSQLITE", "QODBC3", "QODBC">@

    Here are my commands:
    @Setting up a MinGW/Qt only environment...
    -- QTDIR set to C:\Qt\2010.05\qt
    -- PATH set to C:\Qt\2010.05\qt\bin
    -- Adding C:\Qt\2010.05\bin to PATH
    -- Adding C:\Windows\System32 to PATH
    -- QMAKESPEC set to win32-g++

    C:\Windows\system32>set mySQLDIR=c:\mySQL

    C:\Windows\system32>cd %QTDIR%\src\plugins\sqldrivers\mysql

    C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mySQLDIR%\inc
    lude" "LIBS+=%mySQLDIR%\lib\libmysql.lib" -o Makefile mysql.pro
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.

    C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Debug all
    mingw32-make[1]: Entering directory C:/Qt/2010.05/qt/src/plugins/sqldrivers/mys ql' g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\2010.05\qt\plugins\sqldrivers\li bqsqlmysqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll tmp/obj/debug_s hared/main.o tmp/obj/debug_shared/qsql_mysql.o tmp/obj/debug_shared/moc_qsql_mys ql.o -L"c:\Qt\2010.05\qt\lib" -L"c:\Qt\2010.05\qt\lib" tmp\obj\debug_shared\qsq lmysqld_resource_res.o c:\mySQL\lib\libmysql.lib -lQtSqld4 -lQtCored4 Creating library file: c:\Qt\2010.05\qt\plugins\sqldrivers\libqsqlmysqld4.a mingw32-make[1]: Leaving directory C:/Qt/2010.05/qt/src/plugins/sqldrivers/mysq
    l'
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory `C:/Qt/2010.05/qt/src/plugins/sqldrivers/mys
    ql'
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
    -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
    -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"........\include\QtCore" -
    I"........\include\QtSql" -I"........\include" -I"c:\mySQL\include" -I"..
    ......\include\ActiveQt" -I"tmp\moc\release_shared" -I"........\mkspecs\win
    32-g++" -o tmp\obj\release_shared\main.o main.cpp
    C:\Qt\2010.05\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_AS
    CII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT
    CORE_LIB -DQT_THREAD_SUPPORT -I"........\include\QtCore" -I"........\incl
    ude\QtSql" -I"........\include" -I"c:\mySQL\include" -I"........\include\A
    ctiveQt" -I"tmp\moc\release_shared" -I"........\mkspecs\win32-g++" -D__GNUC
    _
    -DWIN32 ......\sql\drivers\mysql\qsql_mysql.cpp -o tmp\moc\release_shared\qsq
    l_mysql.moc
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
    -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
    -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"........\include\QtCore" -
    I"........\include\QtSql" -I"........\include" -I"c:\mySQL\include" -I"..
    ......\include\ActiveQt" -I"tmp\moc\release_shared" -I"........\mkspecs\win
    32-g++" -o tmp\obj\release_shared\qsql_mysql.o ......\sql\drivers\mysql\qsql_m
    ysql.cpp
    C:\Qt\2010.05\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_AS
    CII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT
    CORE_LIB -DQT_THREAD_SUPPORT -I"........\include\QtCore" -I"........\incl
    ude\QtSql" -I"........\include" -I"c:\mySQL\include" -I"........\include\A
    ctiveQt" -I"tmp\moc\release_shared" -I"........\mkspecs\win32-g++" -D__GNUC
    _
    -DWIN32 ......\sql\drivers\mysql\qsql_mysql.h -o tmp\moc\release_shared\moc_q
    sql_mysql.cpp
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
    -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
    -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"........\include\QtCore" -
    I"........\include\QtSql" -I"........\include" -I"c:\mySQL\include" -I"..
    ......\include\ActiveQt" -I"tmp\moc\release_shared" -I"........\mkspecs\win
    32-g++" -o tmp\obj\release_shared\moc_qsql_mysql.o tmp\moc\release_shared\moc_qs
    ql_mysql.cpp
    windres -i qsqlmysql_resource.rc -o tmp\obj\release_shared\qsqlmysql_resource_re
    s.o --include-dir=. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_
    NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB
    -DQT_THREAD_SUPPORT
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -Wl,-s -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\2010.05\qt\plugins\sqldri
    vers\libqsqlmysql4.a -o ........\plugins\sqldrivers\qsqlmysql4.dll tmp/obj/re
    lease_shared/main.o tmp/obj/release_shared/qsql_mysql.o tmp/obj/release_shared/m
    oc_qsql_mysql.o -L"c:\Qt\2010.05\qt\lib" -L"c:\Qt\2010.05\qt\lib" tmp\obj\relea
    se_shared\qsqlmysql_resource_res.o c:\mySQL\lib\libmysql.lib -lQtSql4 -lQtCore4

    Creating library file: c:\Qt\2010.05\qt\plugins\sqldrivers\libqsqlmysql4.a
    mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/src/plugins/sqldrivers/mysq
    l'

    C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql>@

    Thanks in advanced, Dukaim

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dukaim
      wrote on last edited by
      #2

      Solved it my copying the libmysql.dll from the mySQL directory to C:\Windows if anyone is having the same problem.

      Thanks tho. :D

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

        That sounds like a terrible idea. Just copy the dll in the very directory of the application you're building, or put it in a safe place in PATH (like the qt/bin subdir of the SDK).

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        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