Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMYSQL Plug in MAC OS 10.15.4 Catalina



  • I have been working my way diligently through all the QT Tutorials I can find, and so far very impressed with what can be achieved. However I now need to start with databases, and starting out wiht MYSQL.

    I have no come across the famous:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

    I am working on a MAC with OS 10.15.4 Catalina
    QT5.14.2 (Open Source Licence)
    MYSQL 8.0.19

    I have installed Connector/C++ 8.0.19 as per the instructions provided at https://doc.qt.io/qt-5/sql-driver.html

    Following the same set of instructions I execute the following in the terminal window:

    cd /Users/Edward/Qt/5.14.2/clang_64/plugins/sqldrivers
    qmake -- MYSQL_PREFIX=/usr/local
    make sub-mysql

    The first line of the above is modified to suit my installation location, the remainder is as per the example provided on the website.
    However when I execute:
    qmake -- MYSQL_PREFIX=/usr/local

    I get the following response:

    Usage: qmake [mode] [options] [files]

    QMake has two modes, one mode for generating project files based on
    some heuristics, and the other for generating makefiles. Normally you
    shouldn't need to specify a mode, as makefile generation is the default
    mode for qmake, but you may use this to test qmake on an existing project...
    followed be all the options available.
    If I then execite the final line of:
    make sub-mysql

    I get the following response:

    make: *** No rule to make target `sub-mysql'. Stop.

    I have searched high and low for a solution to this problem, however none of the posting I found have helped me to resolve this problem.

    Additional information.
    I used the QT online installer.
    I uninstalled and downloaded source and tried to compile from source, there were so many errors in this process I decided to uninstall and do a clean install using the online installer again.

    My installation folders for all key elements are as follows:

    /Users/Edward/Qt/5.14.2/clang_64/plugins/sqldrivers
    /usr/local/mysql-8.0.19-macos10.15-x86_64
    /usr/local/mysql-connector-c++-8.0.19

    I am on a steep learning curve, and doing my best to work my way through the forums and anywhere else I can find potential solution, but after three day of beating my head against the wall I would greatly appreciate if anyone can give me some guidance in layman terms so I an understand what I am doing wrong and fix the problem.

    My thanks in advance to anyone who can help.



  • Finally resolved this issue thanks to this post:
    https://forum.qt.io/topic/106565/mysql-qt-create-plugin-mysql-for-qt-on-mac

    Followed the instructions in this post step by step and it worked perfectly, I was missing the last step in the process...editing the environment to include the modified path.



  • I don't use MAC but I think you should run qmake under Src\qtbase\src\plugins\sqldrivers if you have installed the source with Qt
    I mean there is no code in Qt/5.14.2/clang_64/plugins



  • @EdBatt said in QMYSQL Plug in MAC OS 10.15.4 Catalina:
    Bonnie,
    Thanks for taking time to try and help me, and my apologies for not responding sooner... for some reason I am not getting post notifications.

    I did as you suggested and although it appeared to work i am still getting the following in the console:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

    The following is the first part of the output from the terminal when running the commands:
    iMac:~ Edward$ cd /Users/Edward/Qt/5.14.2/Src/qtbase/src/plugins/sqldrivers
    iMac:sqldrivers Edward$ qmake -- MYSQL_PREFIX=/usr/local
    Info: creating stash file /Users/Edward/Qt/5.14.2/Src/qtbase/src/plugins/sqldrivers/.qmake.stash

    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... yes
    Checking for OCI (Oracle)... no
    Checking for ODBC... no
    Checking for PostgreSQL... no
    Checking for SQLite (version 2)... no
    Checking for TDS (Sybase)... no
    Done running configuration tests.

    Configure summary:

    Qt Sql Drivers:
    DB2 (IBM) .............................. no
    InterBase .............................. no
    MySql .................................. yes
    OCI (Oracle) ........................... no
    ODBC ................................... no
    PostgreSQL ............................. no
    SQLite2 ................................ no
    SQLite ................................. yes
    Using system provided SQLite ......... no
    TDS (Sybase) ........................... no

    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/Users/Edward/Qt/5.14.2/clang_64'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    I am not sure that it will make any difference, however instead of running just make sub-mysql I am going to try make install

    I will let you know if that fixes anything, but somehow I doubt it as I have tried that before. I assume the SDK is installed with the online installer. Unfortunately for some reason it is very difficult to access any of QT downloads in my region. It can take days just to get access to the online installer.



  • Finally resolved this issue thanks to this post:
    https://forum.qt.io/topic/106565/mysql-qt-create-plugin-mysql-for-qt-on-mac

    Followed the instructions in this post step by step and it worked perfectly, I was missing the last step in the process...editing the environment to include the modified path.


Log in to reply