Results 1 to 8 of 8

Thread: QSqlDatabase: QMYSQL driver not loaded

  1. #1
    Join Date
    Oct 2011
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default QSqlDatabase: QMYSQL driver not loaded

    I use Mac OS X, I did download of QT, have been installed.

    But when I use QT Creator for compile my applications and tried connect in MYSQL this error happened :

    Qt Code:
    1. QSqlDatabase: QMYSQL driver not loaded
    2. QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
    To copy to clipboard, switch view to plain text mode 

    I thanks who can help me !
    Last edited by edsonmcz; 16th October 2011 at 18:28.

  2. #2
    Join Date
    Oct 2011
    Location
    Russia, Ivanovo
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: QSqlDatabase: QMYSQL driver not loaded


  3. #3
    Join Date
    Oct 2011
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    I don't unsdertand, I try this :

    "INCLUDEPATH = /usr/local/mysql-5.5.9-osx10.6-x86_64/include" "LIBS =- L / usr/local/mysql-5.5.9-osx10.6-x86_64/lib-lmysqlclient_r"mysql.pro

    I haven't folder mysql-5.5.9-osx10.6-x86_64.

    But this way don't exist in my path.

    Thanks for help me.

    For MacOs X
    Download and install QTSDK. After this, go to the configuration utility and install additional islhodnye codes.
    Download and affix the software package MySQL (for example a mysql-5.1.53-osx10.6-x86_64.dmg, although the service I did not start.)
    Next, look for a folder with qmake (/ Users/inbush/QtSDK/Desktop/Qt/471/gcc/bin/qmake)
    Folder with the source MySQL (/ usr/local/mysql-5.1.53-osx10.6-x86_64/include)
    Open a terminal and go to the folder plugin (Creativus: ~ inbush $ cd / Users/inbush/QtSDK/QtSources/4.7.1/src/plugins/sqldrivers/mysql)
    Putting the project / Users/inbush/QtSDK/Desktop/Qt/471/gcc/bin/qmake-o Makefile "INCLUDEPATH = / usr/local/mysql-5.1.53-osx10.6-x86_64/include" "LIBS =- L / usr/local/mysql-5.1.53-osx10.6-x86_64/lib-lmysqlclient_r "mysql.pro
    make
    make install


    Added after 34 minutes:


    I tried this too :


    macbookpro$ ./qmake -o Makefile "INCLUDEPATH+=/Users/macbookpro/mysql-5.5.9-osx10.6-x86_64/include" "LIBS+=-L/Users/macbookpro/mysql-5.5.9-osx10.6-x86_64/lib-lmysqlclient_r" mysql.pro
    Cannot find file: mysql.pro.
    :bin macbookpro$
    Last edited by edsonmcz; 16th October 2011 at 20:47.

  4. #4
    Join Date
    Oct 2011
    Location
    Russia, Ivanovo
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    No, you are wrong. Lets try from the verybeginning, step by step. I'm using Mac OS too.
    1. Download and install QTSDK. After this, go to the configuration SDK utility and install additional source codes for the version of Qt you use.
    2. Download and install the software package MySQL (for example a mysql-5.1.53-osx10.6-x86_64.dmg) (I couldn't compile drivers for 5.5 version. in the previous post has version mistake, my fault)
    3. Next, look for a folder with qmake (/ Users/inbush/QtSDK/Desktop/Qt/471/gcc/bin/qmake) (or the version you use, now it is 474)
    4. Folder with the source MySQL (/usr/local/mysql-5.1.53-osx10.6-x86_64/include) (if you user another version change the version numbers of mysql) (shift+command+G - the folder is hidden)
    5. Open a terminal and go to the folder plugin (Creativus: ~ inbush $ cd / Users/inbush/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/mysql) (remember about the version, <inbush> - user)
    6. In terminal execute
    /Users/<username>/QtSDK/Desktop/Qt/474/gcc/bin/qmake-o Makefile "INCLUDEPATH = /usr/local/mysql-5.1.53-osx10.6-x86_64/include" "LIBS =- L /usr/local/mysql-5.1.53-osx10.6-x86_64/lib-lmysqlclient_r "mysql.pro

    this will execute qmake
    7. in terminal make
    8. in terminal make install

    thats all. Woks on snow leo and lion x64 with 471-474 Qt and 5.1.x MySQL

    If you get any mistakes post them here i'll try to help you.

  5. #5
    Join Date
    Oct 2011
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Thanks a lot

    I think that I did all, but now this error is happened


    Qt Code:
    1. MacBook-Pro:mysql macbookpro$ /Users/macbookpro/QtSDK/Simulator/Qt/gcc/bin/qmake Makefile "INCLUDEPATH = /usr/local/mysql-5.5.9-osx10.6-x86_64/include" "LIBS =- L /usr/local/mysql-5.5.9-osx10.6-x86_64/lib-lmysqlclient_r "mysql.pro
    2. Cannot find file: Makefile.
    3. MacBook-Pro:mysql macbookpro$
    To copy to clipboard, switch view to plain text mode 

    I don't know what is this error, thanks for help me !


    Added after 26 minutes:


    This error happened:

    Qt Code:
    1. MacBook-Pro:mysql macbookpro$ /Users/macbookpro/QtSDK/Simulator/Qt/gcc/bin/qmake -o Makefile "INCLUDEPATH = /usr/local/mysql-5.5.9-osx10.6-x86_64/include" "LIBS = -L /usr/local/mysql-5.5.9-osx10.6-x86_64/lib -lmysqlclient_r " mysql.pro
    2. MacBook-Pro-de-MacBook-Pro:mysql macbookpro$ make
    3. make -f Makefile.Debug all
    4. rm -f libqsqlmysql_debug.dylib
    5. g++ -headerpad_max_install_names -arch x86_64 -single_module -dynamiclib -Xarch_x86_64 -mmacosx-version-min=10.5 -Xarch_x86_64 -mmacosx-version-min=10.5 -o libqsqlmysql_debug.dylib .obj/debug-shared/main.o .obj/debug-shared/qsql_mysql.o .obj/debug-shared/moc_qsql_mysql.o -F/Users/macbookpro/lib -L/Users/macbookpro/lib -L /usr/local/mysql-5.5.9-osx10.6-x86_64/lib -lmysqlclient_r -framework QtSql -L/Users/macbookpro/lib -F/Users/macbookpro/lib -framework QtCore
    6. ld: -L must be immediately followed by a directory path (no space)
    7. collect2: ld returned 1 exit status
    8. make[1]: *** [../../../../../../../plugins/sqldrivers/libqsqlmysql_debug.dylib] Error 1
    9. make: *** [debug-all] Error 2
    10. MacBook-Pro:mysql macbookpro$
    To copy to clipboard, switch view to plain text mode 


    Added after 15 minutes:


    I tried this form too :

    Qt Code:
    1. MacBook-Pro:mysql macbookpro$ /Users/macbookpro/QtSDK/Simulator/Qt/gcc/bin/qmake -o Makefile "INCLUDEPATH = /usr/local/mysql-5.5.9-osx10.6-x86_64/include" "LIBS =- L /usr/local/mysql-5.5.9-osx10.6-x86_64/lib -lmysqlclient_r " mysql.pro
    2. MacBook-Pro:mysql macbookpro$ makemake -f Makefile.Debug allrm -f libqsqlmysql_debug.dylibg++ -headerpad_max_install_names -arch x86_64 -single_module -dynamiclib -Xarch_x86_64 -mmacosx-version-min=10.5 -Xarch_x86_64 -mmacosx-version-min=10.5 -o libqsqlmysql_debug.dylib .obj/debug-shared/main.o .obj/debug-shared/qsql_mysql.o .obj/debug-shared/moc_qsql_mysql.o -F/Users/macbookpro/lib -L/Users/macbookpro/lib - L /usr/local/mysql-5.5.9-osx10.6-x86_64/lib -lmysqlclient_r -framework QtSql -L/Users/macbookpro/lib -F/Users/macbookpro/lib -framework QtCore
    3. i686-apple-darwin10-g++-4.2.1: L: No such file or directory
    4. i686-apple-darwin10-g++-4.2.1: -E or -x required when input is from standard input
    5. make[1]: *** [../../../../../../../plugins/sqldrivers/libqsqlmysql_debug.dylib] Error 1
    6. make: *** [debug-all] Error 2
    To copy to clipboard, switch view to plain text mode 

    Thanks a lot
    Last edited by edsonmcz; 17th October 2011 at 00:01.

  6. #6
    Join Date
    Oct 2011
    Location
    Russia, Ivanovo
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    In my opinion you should try to compile with /QtSDK/Desktop/Qt/474/gcc qmake directory.

    Also several months ago i tryed to compile mysql5.5x drivers too, and failed. So I removed MySQL 5.5 and installed 5.1.x Mysql ver. Everything compiled from the first time. But i Got a problem with removing MySQL. After removing the installation of the earlier version was impossible. Short instruction how to solve this problem, if you need.

    sudo rm /usr/local/mysql
    sudo rm rf /usr/local/mysql*
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    edit /etc/hostconfig and remove the line MYSQLCOM=-YES
    rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*

    Also do the following and you will be able to completely remove MySQL 5.5 from Mac OS 10 Snow Leopard.

    sudo rm -rf /private/var/db/receipts/com.mysql.mysql*

    after this install 5.1 version with libraries and recompile drvs from the beginning.

    After i installed 5.1 version and compiled drivers, I use them with 5.5 versions (installed on other server) for a long time with mo errors and good stability.

  7. #7
    Join Date
    Oct 2011
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Before, thanks a lot.

    Sorry, I have many applications run in MySql, then I tried use Sqlite.

    Was work very good.

  8. #8
    Join Date
    Jun 2010
    Location
    Hangzhou, China
    Posts
    10
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    1. download mysql from mysql official website, notice correspond with your system
    2. setup it
    3. qmake mysql plugin in Qt plugin folder with source code
    4. make install in source code folder
    5. use it.
    Notice: check mysql dynamic library in library path after you install mysql package.

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By onder in forum Newbie
    Replies: 12
    Last Post: 29th March 2017, 15:43
  2. Need Help:QSqlDatabase: QMYSQL driver not loaded
    By i4ba1 in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2011, 19:39
  3. QSqlDatabase: QMYSQL driver not loaded
    By earthling in forum Qt Programming
    Replies: 13
    Last Post: 4th December 2010, 16:19
  4. QSqlDatabase: QMYSQL driver not loaded
    By lise in forum Newbie
    Replies: 3
    Last Post: 1st June 2010, 14:09
  5. Replies: 6
    Last Post: 28th April 2009, 07:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.