Important: Please read the Qt Code of Conduct -

QT5.4 embedded mysqld?

  • I am overlooking the obvious on this I gues.

    Now, I have mysql working just fine. But I now want to create a stand alone that has its own db and thus required the embedded.

    bq. To use the embedded MySQL server, simply link the Qt plugin to libmysqld instead of libmysqlclient. This bq. can be done by replacing -lmysqlclient_r by -lmysqld in the qmake command in the section below.

    This however seems more suited for unix and macosx.
    Normal compiling on windows does give a qsqlmysql.dll and a qsqlmysqld.dll

    What needs to be done on windows then?

  • Lifetime Qt Champion


    These instructions are valid also for Windows, just rebuild the plugins following them

  • I would If I knew what to swap.

    @cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib"

    Trying to see a link with the unix line i would look for a libmysqld.lib file wich is not present. So what changes into what to get the proper dll?

    This raises 2 more questions.

    1. Why does compiling mysql outputs libmysql and libmysqld files then if only the libmysql one is usefull?
    2. Does this mean that a program can only use one of each type?
      Only embedded or only external? Not a combination of a local table + a remote one?

  • Lifetime Qt Champion

    How did you get MySQL ?

    1. libmysqld should be the embedded server library although the naming scheme is a bit misleading
    2. Yes. It would be like trying to use a table from databases located on two different MySQL servers.

  • I have builded the libs with mingw.
    mysql client part is working perfectly.
    Just wondering how to "link(QMYSQL?)" "what(mysqld.dll?)" to move from client to embedded.

    Working on a tool that reads files and process the content into an offline database. For a big part I can reuse a previous tool that has the same concept. I did install and use mysql on the nas there. This tool now can be used by everyone.

    Did not know/expect there would be a limit on using tables from different servers. Handy for offline duty that uses parameters stored in an online table.

  • Lifetime Qt Champion

    Like suggested in the doc link to mysqld rather than mysqlclient_r

    I didn't say there was a limit, but from what I understood of your description you were trying to use tables from the different databases like they were all from the same which is not possible. However you can create several connections and use several databases without any problem.

  • Lifetime Qt Champion

    An additional note, if you want to access both embedded and remote MySQL databases at the same time that would require two different MySQL plugins one linked with each library.

  • Sorry for not seeing it but the docs suggest this for unix/osx.
    I can't port the suggestion over to windows just like that as for windows there is no "mysqlclient_r" to replace (see the command for compiling on windows.)

    @cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server <version>/lib/opt/libmysql.lib"

    Thanks for clarifying about the mysql possibilities. Might need it one day.

  • Lifetime Qt Champion

    The naming is a bit different on Windows

Log in to reply