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. Problem Loading QMYSQL driver in my Qt Quick project.
Forum Updated to NodeBB v4.3 + New Features

Problem Loading QMYSQL driver in my Qt Quick project.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 427 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.
  • carles.sole.grauC Offline
    carles.sole.grauC Offline
    carles.sole.grau
    wrote on last edited by carles.sole.grau
    #1

    Hi everybody,
    I'm trying to connect to a MySQL database so in my main.cpp file I added this code:

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
        db.setHostName("example");
        db.setDatabaseName("example");
        db.setUserName("example");
        db.setPassword("mypassord");
        if(!db.open())
           qWarning( "Connection FAILED." );;
    

    When I execute all the project (Qt Quick):

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Connection FAILED.
    

    It seems like Qt knows QMYSQL driver is available but it doesn't load it.

    I find some information in the forum but it doesn't help me,

    Does anyone know how to fix it? I'm using Qt 5.6 in Ubuntu 16.04-

    Thank you very much.

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

      Hi,

      That has nothing to do with QtQuick.

      Did you install MySQL's client libraries ? If so then run ldd on the Qt's MySQL plugin. You'll likely find that the client library used to build Qt is older than the one you have installed on your machine.

      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