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. QMYSQL Driver Not Loaded
Forum Updated to NodeBB v4.3 + New Features

QMYSQL Driver Not Loaded

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 510 Views 2 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.
  • A Offline
    A Offline
    AdeSho
    wrote on last edited by
    #1

    Hi there

    I am VERY new to python and even newer to PyQt5.

    I tried Tkinter but found it limited however I was able to connect to my MySQL database. With PyQt5 it has been impossible. I get the error message “QMYSQL Driver not loaded”. I came across all kinds of complex solutions online which I didn’t understand. In one case I was told to download QT which I did but don’t understand why. There was also mention of “qmake ” , “otool” and other things that I have no clue what they mean.

    Surely it should not be this difficult to connect to a DB. I’m afraid I may overwhelm my laptop or worse crash it trying to follow these incoherent solutions. I’m using Mac Big Sur, Python 3, PyQt5. I will be grateful for any help - it's been 5 days wrangling with this problem and I'm not knowledgeable enough to alter paths etc etc etc.

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

      Hi and welcome to the forums.
      The reason its a bit compicated is that Qt does not come with the actual driver for QMYSQL but only a plugin that can use the driver so
      you are required to download the QMYSQL client libs for your platform (matching 32 bit or 64 bit) and then compile the Qt plugin so it uses your client driver.

      https://doc.qt.io/qtforpython/overviews/sql-driver.html
      This is for PySide6 though. Not 100% sure its exactly the same for PyQt5 as its not a Qt company product.

      Note this is for Qt 6. if using another version please note that this uses cmake tool and the older version uses the qmake tool.

      The SQlite database on the other hand comes fully included.

      It seems py5 can talk to mysql directly
      https://pypi.org/project/mysqlclient/

      But if you want to use Qt wrapper, you have to build it first.

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

        Hi and welcome to devnet,

        Are you tied to MySQL ?
        If not, I would recommend switching to PostgreSQL which should have the plugin pre-built and also has a nice package that is easy to install on macOS.

        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
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved