Results 1 to 3 of 3

Thread: Using mysql database

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2016
    Qt products
    Unix/X11 Windows

    Default Using mysql database

    I am new to Qt and am trying to use the mysql database on a windows installation. I have already spent too much time and can't sort it out.

    I have QTPLUGIN += qsqlmysql and QT += sql in the .pro file. When I load the project I get a message. two of them that it is redundant. It isn't any better when I leave the line out. I checked in the plugin directory and it is there.

    I also have the -llibmysql entry added to the LIBS's path
    win32:CONFIG(release, debug|release): LIBS += -L"C:/Program Files/MariaDB 10.1/lib/" -llibmysql

    The application seems to build correctly.

    my database access is copied from somewhere:
    Qt Code:
    1. bool createConnection()
    2. {
    3. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    4. db.setHostName("localhost");
    5. db.setDatabaseName("testdb");
    6. db.setUserName("root");
    7. db.setPassword("rmsipw");
    8. if (! {
    9. qDebug() << "Database error occurred";
    10. return false;
    11. }
    12. return true;
    13. }
    To copy to clipboard, switch view to plain text mode 

    when it runs I get:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3
    Database error occurred
    Not Connected:

    It is way more complicated then this: My application wants to compile with an old version of mingw on my machine. Even though the default kit is Desktop Qt 5.7.0 MSVC2013 64bit is the default Kit?
    Last edited by raymadigan; 23rd August 2016 at 21:34.

Similar Threads

  1. Linking Qt with Database MySql
    By SumitVaise in forum Newbie
    Replies: 2
    Last Post: 3rd August 2015, 21:13
  2. How to Connect to MySQL database
    By johnL in forum Newbie
    Replies: 12
    Last Post: 16th May 2015, 16:43
  3. Qt and MySQL database
    By Stanfillirenfro in forum Qt Programming
    Replies: 0
    Last Post: 26th June 2013, 07:58
  4. Cannot connect to mysql database
    By phapha in forum Newbie
    Replies: 3
    Last Post: 27th October 2011, 14:58
  5. Qt and MySQL Database Connection
    By shamik in forum Qt Programming
    Replies: 41
    Last Post: 6th October 2006, 12:48

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.