Results 1 to 8 of 8

Thread: Qt + Mysql on Mac OS X

  1. #1
    Join Date
    Jan 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Qt + Mysql on Mac OS X

    Hi guys,

    i'm trying build the MySQL plugin for qt, but i have some problems..

    in accordance with this site (http://qt.nokia.com/doc/4.0/sql-driv...x-and-mac-os-x), these are the steps:

    Qt Code:
    1. Tell qmake where to find the MySQL header files and shared libraries (here it is assumed that MySQL is installed in /usr/local) and run make:
    2. cd $QTDIR/src/plugins/sqldrivers/mysql
    3. qmake -o Makefile "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient" mysql.pro
    4. make
    To copy to clipboard, switch view to plain text mode 

    but, when I put "cd /Developer/Applications/Qt/plugins/sqldrivers/mysql", this is the result:



    Help-me *----*

  2. #2
    Join Date
    Sep 2009
    Posts
    72
    Thanked 10 Times in 10 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: Qt + Mysql on Mac OS X

    Hi

    you must have downloaded qt without sources. you need to have that sqldrivers folder with sources in src/plugins directory. I tried to add that aattachment but i was not able to attach it.

    You do not need complete source just that plugins folder in src is enough for you

  3. #3
    Join Date
    Jan 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt + Mysql on Mac OS X

    Can you upload the plugins folder in src for me??
    please *-*

  4. #4
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt + Mysql on Mac OS X

    in accordance with this site (http://qt.nokia.com/doc/4.0/sql-driv...x-and-mac-os-x), these are the steps:
    It also says:
    You need the MySQL header files and as well as the shared library libmysqlclient.so. Depending on your Linux distribution you may need to install a package which is usually called "mysql-devel"
    Now, I don't know much about Mac's (besides I can't afford one...), but you should use your package manager to download the package. Or maybe get it from the MySQL website?

  5. #5
    Join Date
    Feb 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Qt + Mysql on Mac OS X

    Hello,

    I am having the exact same issue.

    - I have triple checked and I only see one QT installer for OS X so I am not sure how one could download QT without the source.
    - I have installed mysql and I have libmysqlclient.dylib , but there is no libmysqlclient.so . Does anyone know if working with a dynamic lib in QT is much different than a shared object?

  6. #6
    Join Date
    Aug 2011
    Location
    Portugal
    Posts
    34
    Thanks
    15
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + Mysql on Mac OS X

    Hi,
    Someone could really make a easy to use installer to make this plugin.

    Anyway the close thing I got to that is: http://code.google.com/p/freemedform...ysql-plugin.sh

    That script aims to build and place the mysql plugin.

    Best regards.

  7. #7
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Qt + Mysql on Mac OS X

    Aims != does

    i wrote here many times and still got no answer or solution.
    I try to compile and install MYSQL driver on Mac OS.I do the following:

    1.Download MySQL for Mac OS
    2.Download QT source code
    3.cd /Users/myuser/Downloads/qt-everywhere-opensource-src-4.7.3/src/plugins/sqldrivers/mysql
    4.set namespec:

    export QMAKESPEC=/Users/myuser/Downloads/qt-everywhere-opensource-src-4.7.3/mkspecs/macx-g++

    5.qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
    6. make

    7.Than i receive 94KB file libqsqlmysql.dylib
    Comparing it with other drivers is too small.
    I copy this file in the /plugin folder of installed QT

    8.I create a new project and add to MyProject.pro QT += sql
    Also #include <QtSql> to the main.cpp

    9. i try this code

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    2. db.setHostName("172.16.10.103");
    3. db.setDatabaseName("test");
    4. db.setUserName("joro");
    5. db.setPassword("test");
    6. bool ok = db.open();
    To copy to clipboard, switch view to plain text mode 

    10. i got this error

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

  8. #8
    Join Date
    Dec 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + Mysql on Mac OS X

    The thread is quite old but could be very useful for someone.
    If you followed these steps http://doc.qt.nokia.com/4.0/sql-driv...x-and-mac-os-x and had no errors/warnings,
    using Qt sources and development package of MySQL , the size of the result lib it's ok (for the release one).
    Point 7 : instead of a direct copy it's better a make install to be sure of the destination path.
    Before the point 8 and after the install there's another step : you've to change the result lib with this cmd (you'll find it in the last rows of the script mentioned by TCB13) :
    Qt Code:
    1. install_name_tool -change libmysqlclient.18.dylib $MYSQL_LIB/libmysqlclient.18.dylib $QT_PLUGIN_PATH/sqldrivers/libqsqlmysql.dylib
    To copy to clipboard, switch view to plain text mode 

    where
    Qt Code:
    1. MYSQL_LIB=/usr/local/mysql/lib
    To copy to clipboard, switch view to plain text mode 
    (normally the dft installation path for MySQL, again see the script)
    and
    Qt Code:
    1. QT_PLUGIN_PATH=`qmake -query QT_INSTALL_PLUGINS`
    To copy to clipboard, switch view to plain text mode 
    .

    MySQL client lib could change on the basis of MySQL api version (check the existent in the previous path).

    After that everything'll work fine.

Similar Threads

  1. I need MySQL driver for Qt 4.6, WindowsXP(32), MySQL 5.1
    By User_3 in forum Installation and Deployment
    Replies: 7
    Last Post: 15th October 2010, 15:19
  2. MySQL on Qt4
    By ^NyAw^ in forum Qt Programming
    Replies: 4
    Last Post: 10th April 2008, 16:12
  3. mysql 5.0.41 and qt 4
    By locus in forum Installation and Deployment
    Replies: 2
    Last Post: 20th June 2007, 07:08
  4. MYSQL 5 Table qt model as small Mysql admin
    By patrik08 in forum Qt-based Software
    Replies: 0
    Last Post: 1st May 2007, 09:43
  5. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19

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.