Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt connection to MySQL database not working (macOS MOJAVE)
Forum Updated to NodeBB v4.3 + New Features

Qt connection to MySQL database not working (macOS MOJAVE)

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 780 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.
  • L Offline
    L Offline
    Liltwiss
    wrote on last edited by
    #1

    Hello guys, hope you're all well
    I have MySQL 5.7 with MAMP installed and Qt 5.12.0.
    I'm not able to connect my Qt application with the Mysql server.

    I've run these 2 following commands:
    1.
    Macs-MacBook-Pro:/ macbook$ find / -iname libmysqlclient.18.dylib
    /usr/local/lib/libmysqlclient.18.dylib
    /usr/local/Cellar/mysql-connector-c/6.1.11/lib/libmysqlclient.18.dylib

    Macs-MacBook-Pro:/ macbook$ install_name_tool -change libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib /Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
    Macs-MacBook-Pro:/ macbook$

    I also tried to follow the following solution: https://forum.qt.io/topic/99776/problem-with-mysql-driver-on-mac

    Here is a screenshot of my "Run Environnement"

    0_1550857475891_Capture d’écran 2019-02-22 à 5.39.31 PM.png

    I've started my application with QT_DEBUG_PLUGINS and this is a part of the output.

    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/macbook/Projets_C++/Projet_Qt/build-Projet_final-Desktop_Qt_5_12_0_clang_64bit-Debug/Projet_final.app/Contents/MacOS/sqldrivers" ...
    Cannot load library /Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
    Referenced from: /Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
    Reason: image not found)
    QLibraryPrivate::loadPlugin failed on "/Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib" : "Cannot load library /Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib\n Referenced from: /Users/macbook/Qt/5.12.0/clang_64/plugins/sqldrivers/libqsqlmysql.dylib\n Reason: image not found)"
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/macbook/Qt/5.12.0/clang_64/plugins/iconengines" ...
    QFactoryLoader::QFactoryLoader() looking at "/Users/macbook/Qt/5.12.0/clang_64/plugins/iconengines/libqsvgicon.dylib"
    Found metadata in lib /Users/macbook/Qt/5.12.0/clang_64/plugins/iconengines/libqsvgicon.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
    "MetaData": {
    "Keys": [
    "svg",
    "svgz",
    "svg.gz"
    ]
    },
    "archreq": 0,
    "className": "QSvgIconPlugin",
    "debug": false,
    "version": 330752
    }

    Got keys from plugin meta data ("svg", "svgz", "svg.gz")
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/macbook/Projets_C++/Projet_Qt/build-Projet_final-Desktop_Qt_5_12_0_clang_64bit-Debug/Projet_final.app/Contents/MacOS/iconengines" ...
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7

    Thanks in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From the looks of it, your install_name_tool call is wrong. You have to path the exact same path as first argument as the one you find from the otool call.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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