Results 1 to 5 of 5

Thread: Raspberry (Jessie): QT5, MySQL

  1. #1
    Join Date
    Dec 2011
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Raspberry (Jessie): QT5, MySQL

    Hi,
    I installed Qt5 on my RaspberryPi (Rasbian Jessie) using:

    sudo apt-get install qt5-default
    sudo apt-get install libqt5svg5*
    sudo apt-get install qttools5-dev

    When I tried to compile and execute a tiný program to access a MySQL database using:

    QString dbname;
    dbname = "QtTestDB";

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setDatabaseName(dbname);
    db.setUserName("root");
    db.setHostName("localhost");
    db.setPort(3306);
    db.setPassword("raspberry");

    if(!db.open()) {
    ui->textEdit->setText("not open !");
    }

    I got the message:

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE
    QSqlQuery::exec: database not open

    The same program worked fine on QT4

    It looks as if there is no MySQL Support for Qt5 on the system.
    Does anybody know how to fix this?

    Thank you!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Raspberry (Jessie): QT5, MySQL

    On desktop Debian the package of the MySQL driver for QSql is called libqt5sql5-mysql

    Cheers,
    _

  3. #3
    Join Date
    Dec 2011
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Raspberry (Jessie): QT5, MySQL

    Thank you for the quick reply.
    I installed libqt5sql5-mysql and libqsqlmysql.so is installed in /usr/lib/arm-Linux-gnueabihf/qt5/plugins/
    but the QMYSQL Driver is still not found!
    What did I forget?

    Thank you

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Raspberry (Jessie): QT5, MySQL

    Hmm, the package dependencies should have ensured all libraries are there, but check with ldd on the plugin .so that it indeed has all the libs it needs.

    You can also try setting the envionment variable QT_DEBUG_PLUGINS to a non-zero value and see if this gives you any more hints

    Cheers,
    _

  5. #5
    Join Date
    Dec 2011
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Raspberry (Jessie): QT5, MySQL

    Thank you!
    Setting QT_DEBUG_PLUGINS was a good idea!
    So I found out that there was some mixture with QT4 which is/was also installed.
    After reconfiguring and recompiling everything is working now!
    Best wishes!

Similar Threads

  1. Qwt, Creator, RapberryPi Jessie
    By hgstoehr in forum Qt Tools
    Replies: 6
    Last Post: 9th March 2016, 22:50
  2. Problems with Qt on Raspberry Pi 2
    By skypuppy in forum Newbie
    Replies: 7
    Last Post: 30th December 2015, 10:53
  3. Replies: 5
    Last Post: 1st July 2015, 14:04
  4. Compiling qt 5.4 for raspberry
    By dram in forum Newbie
    Replies: 5
    Last Post: 15th February 2015, 23:21

Bookmarks

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.