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 problem [Solved]
QtWS25 Last Chance

MySQL driver problem [Solved]

Scheduled Pinned Locked Moved Installation and Deployment
21 Posts 4 Posters 13.0k Views
  • 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.
  • S Offline
    S Offline
    Skyrim
    wrote on last edited by
    #2

    Hi, try this

    1. Install MySql server with libs (for exam C:\MySQL)
    2. Install QtSDK with source (for exam C:\QtSDK)
    3. Run Qt 4.7.3 for Desktop (mingw)
      @
      set QTDIR=C:\QtSDK\QtSource\

    set mySQLDIR=C:\MySQL

    cd %QTDIR%\src\plugins\sqldrivers\mysql

    qmake "INCLUDEPATH+=%mySQLDIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib"-o Makefile mysql.pro

    mingw32-make
    @
    4. Go to %QTDIR%\src\plugins\sqldrivers\mysql and copy in
    C:\QtSQK\Desktop\Qt\4.7.3\mingw\plugins\sqldrivers 2 files - libqsqlmysqld4.a and qsqlmysqld4.dll.
    5. And from C:\MySQL\bin file libmysql.dll in dir C:\WINDOWS

    Test:
    qDebug() << QSqlDatabase::drivers();
    must be ("QSQLITE", "QMYSQL3", "QMYSQL")

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wimschuiteman
      wrote on last edited by
      #3

      hello
      This I also found on the Internet.
      But I do not know how to do Step 3.
      Should I make a new project with Qt Creator. Or something else?

      Regards,
      Wim

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #4

        I edited step 3 above for formatting. The individual steps had run together.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Skyrim
          wrote on last edited by
          #5

          something else )

          Run (round button) - All programms - Qt SDK - Desktop - run Qt 4.7.4 for Desktop (mingw) - step 3

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wimschuiteman
            wrote on last edited by
            #6

            Thanks for the responses.

            I see now that I have Qt 4.8.0.
            If I try this code "QTDIR = C: \ QtSDK \ QtSource \ 4.8.0".
            I get the following error: "QTDIR is not recognized internal or external command,"

            Regards,
            Wim

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #7

              No, the command is:
              @
              set QTDIR=C:\QtSDK\QtSource\4.8.0
              @
              (mind the spaces)

              You're assigning "C:\QtSDK\QtSource\4.8.0" to a variable called "QTDIR"

              Software Engineer
              My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Skyrim
                wrote on last edited by
                #8

                be carefully
                not "QTDIR = C: \ QtSDK \ QtSource \ 4.8.0"

                must be "set QTDIR = C:\QtSDK\QtSource\4.8.0"

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  wimschuiteman
                  wrote on last edited by
                  #9

                  It doesn't work.
                  !http://www.schuitemandev.nl/Images/Window.jpg(Windows)!

                  Regards,
                  Wim

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    wimschuiteman
                    wrote on last edited by
                    #10

                    [quote author="Skyrim" date="1331767772"]be carefully
                    not "QTDIR = C: \ QtSDK \ QtSource \ 4.8.0"

                    must be "set QTDIR = C:\QtSDK\QtSource\4.8.0"[/quote]

                    Yes that works.

                    Regards,
                    Wim

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Skyrim
                      wrote on last edited by
                      #11

                      Oh yes, its doesn't work.
                      please write to

                      "set QTDIR = C:\QtSDK\QtSource\4.8.0"

                      1 Reply Last reply
                      0
                      • W Offline
                        W Offline
                        wimschuiteman
                        wrote on last edited by
                        #12

                        But now i have another error.!http://www.schuitemandev.nl/Images/Window1.jpg(Dos window)!

                        Regards,
                        Wim

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mlong
                          wrote on last edited by
                          #13

                          Is your QtSDK installed in C:\QtSDK, or E:\QtSDK? Your first "set" command is using E: not C:

                          And it's supposed to be "set QTDIR= " not "set QTDIR- "

                          Also, it should be "set mySQLDIR= " not "set mSQLDIR- "

                          And when you do the "cd", it should take you to whatever directory has the "mysql.pro", not remain in system32.

                          Software Engineer
                          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                          1 Reply Last reply
                          0
                          • W Offline
                            W Offline
                            wimschuiteman
                            wrote on last edited by
                            #14

                            My QtSDK is installed in E:\QtSDK.
                            I have found mysql.pro in the map "E:\QtSDK\QtSources\4.8.0\src\plugins\sqldrivers\mysql".
                            libmysql.lib in the map C:\MySQL\MySQL51\lib\opt.
                            !http://www.schuitemandev.nl/Images/Window2.jpg(Window)!

                            Regards,
                            Wim

                            1 Reply Last reply
                            0
                            • W Offline
                              W Offline
                              wimschuiteman
                              wrote on last edited by
                              #15

                              I saw that I had forgotten something.
                              !http://www.schuitemandev.nl/Images/Window3.jpg(window)!

                              Regards,
                              Wim

                              1 Reply Last reply
                              0
                              • W Offline
                                W Offline
                                wimschuiteman
                                wrote on last edited by
                                #16

                                I think I'm one step further.

                                but I get 2 errors.
                                @Setting up environment for Qt usage...

                                C:\Windows\system32>set QTDIR = C:\QtSDK\QtSource\4.7.4

                                C:\Windows\system32>set mySQLDIR=C:\MySQL

                                C:\Windows\system32>cd %QTDIR%\src\plugins\sqldrivers\mysql
                                Het systeem kan het opgegeven pad niet vinden.

                                C:\Windows\system32>cd C:\QtSDK\QtSource\4.7.4\src\plugins\sqldrivers\mysql
                                Het systeem kan het opgegeven pad niet vinden.

                                C:\Windows\system32>QTDIR=C:\QtSDK\QtSources
                                QTDIR wordt niet herkend als een interne
                                of externe opdracht, programma of batchbestand.

                                C:\Windows\system32>set QTDIR=C:\QtSDK\QtSources\4.7.4

                                C:\Windows\system32>set mySQLDIR=C:\MySQL

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

                                C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mySQL
                                DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib"-o Makefile mysql.pro
                                WARNING: (internal):1: Unescaped backslashes are deprecated.
                                c:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql\Makefile:9: Parse Error ('
                                first: debug')
                                Error processing project file: Makefile
                                WARNING: (internal):1: Unescaped backslashes are deprecated.
                                WARNING: (internal):1: Unescaped backslashes are deprecated.
                                WARNING: (internal):1: Unescaped backslashes are deprecated.

                                C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>mingw32-make
                                mingw32-make -f Makefile.Debug
                                mingw32-make[1]: Entering directory C:/QtSDK/QtSources/4.7.4/src/plugins/sqldri vers/mysql' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT - DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\m ingw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Ac tiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -o debug\m ain.o main.cpp C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQ T_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQ T_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAV E_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I "c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\min gw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Acti veQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -D__GNUC__ - DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.cpp -o debug\qsql_mysql.moc g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT - DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\m ingw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Ac tiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -o debug\q sql_mysql.o ..\..\..\sql\drivers\mysql\qsql_mysql.cpp C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQ T_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQ T_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAV E_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I "c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\min gw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Acti veQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -D__GNUC__ - DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.h -o debug\moc_qsql_mysql.cpp g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT - DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\m ingw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Ac tiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -o debug\m oc_qsql_mysql.o debug\moc_qsql_mysql.cpp windres -i qsqlmysqld_resource.rc -o debug\qsqlmysqld_resource_res.o --include-d ir=. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_AS CII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNO W -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT g++ -mthreads -shared -Wl,--out-implib,debug\libqsqlmysqld4.a -o debug\qsqlmysql d4.dll debug/main.o debug/qsql_mysql.o debug/moc_qsql_mysql.o -L"c:\QtSDK\Deskt op\Qt\4.7.4\mingw\lib" debug\qsqlmysqld_resource_res.o C:\MySQL\lib\opt\libmysql .lib-o -lQtSqld4 -lQtCored4 g++: C:\MySQL\lib\opt\libmysql.lib-o: No such file or directory mingw32-make[1]: *** [debug\qsqlmysqld4.dll] Error 1 mingw32-make[1]: Leaving directory C:/QtSDK/QtSources/4.7.4/src/plugins/sqldriv
                                ers/mysql'
                                mingw32-make: *** [debug] Error 2

                                C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>@

                                Regards,
                                Wim

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  Skyrim
                                  wrote on last edited by
                                  #17

                                  error in 24 line
                                  you line:
                                  @
                                  DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib"-o Makefile mysql.pro
                                  @
                                  must be
                                  @
                                  DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib" -o Makefile mysql.pro //need space before -o
                                  @

                                  1 Reply Last reply
                                  0
                                  • W Offline
                                    W Offline
                                    wimschuiteman
                                    wrote on last edited by
                                    #18

                                    Hello
                                    I now work.
                                    I have Qt 4.8.0 removes. And 4.7.4. installed.
                                    Thanks everyone for the responses.

                                    Wim

                                    Regards,
                                    Wim

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      Skyrim
                                      wrote on last edited by
                                      #19

                                      Congratulations on your victory!

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        mlong
                                        wrote on last edited by
                                        #20

                                        Be sure and edit your original post to add [Solved] to the title. Thanks!

                                        Software Engineer
                                        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                                        1 Reply Last reply
                                        0
                                        • Z Offline
                                          Z Offline
                                          zhuyeat
                                          wrote on last edited by
                                          #21

                                          hello:

                                          why my i have no QtSource subfolder under QtSDK folder and have no mysql sobfolder under sqldrivers folder? thank you!

                                          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