Results 1 to 2 of 2

Thread: QMYSQL driver not loaded error

  1. #1
    Join Date
    Mar 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    9

    Default QMYSQL driver not loaded error

    I've got that error when trying to run a program so I've tried to look for the solution on the web, but I still don't get it fixed. So pls help me.
    This is the code I've tried to find out the extractly error.
    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QSqlDatabase>
    3. #include <QSqlError>
    4. #include <QStringList>
    5. #include <QtDebug>
    6. int main(int argc, char *argv[])
    7. {
    8. QCoreApplication app( argc, argv );
    9. qDebug() << QSqlDatabase::drivers();
    10. QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
    11. qDebug() << db.lastError();
    12. }
    To copy to clipboard, switch view to plain text mode 
    And this is the result:

    Qt Code:
    1. ("QSQLITE")
    2. QSqlDatabase: QMYSQL driver not loaded
    3. QSqlDatabase: available drivers: QSQLITE
    4. QSqlError(-1, "Driver not loaded", "Driver not loaded")
    To copy to clipboard, switch view to plain text mode 

    my .pro file is:

    Qt Code:
    1. QT += sql
    2. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    I've think i don't have the MySQL driver installed but I don't know how to install it.
    I've tried to configure like following:
    Qt Code:
    1. qmake "INCLUDEPATH+=-I/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
    To copy to clipboard, switch view to plain text mode 

    and then run make but this is what it return:

    Qt Code:
    1. ../../../../include/QtCore/../../corelib/arch/qatomic_arch.h:88:4: error: #error "Qt has not been ported to this architecture"
    2. .......
    3. make: *** [.obj/release-shared/main.o] Error 1.
    To copy to clipboard, switch view to plain text mode 

    Anyone help me fix this error.
    Thanks for your attentions.
    P/S: if that is an uninstalled mysql driver error, please tell me how to install it in detail cause i'm totally newbie.

    I'm using Redhat Enterprise, Qt 4.5.3 and MySQL 5
    Last edited by mr.dct; 31st March 2010 at 15:50.

  2. #2
    Join Date
    Mar 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    9

    Default Re: QMYSQL driver not loaded error

    OK! My problem is fixed. It seems my install packet is error. I re-uncompress my qt packet, reconfigure and run qmake qmake install. It took approximately 3 hours to install and finally my program worked. Thanks alot

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By earthling in forum Qt Programming
    Replies: 13
    Last Post: 4th December 2010, 16:19
  2. QMYSQL driver not loaded
    By cydside in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2010, 03:18
  3. QMYSQL driver not loaded
    By akhila in forum Newbie
    Replies: 1
    Last Post: 22nd February 2010, 19:24
  4. Replies: 6
    Last Post: 28th April 2009, 07:58
  5. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 21:15

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
  •  
Qt is a trademark of The Qt Company.