Results 1 to 2 of 2

Thread: mysql is installed but can not load

  1. #1
    Join Date
    Jan 2013
    Posts
    44
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default mysql is installed but can not load

    hi everyone,i have install mysql on window with vs2008 complete
    but when i test a code as belows,it can not load ,plz help
    this is a test code:
    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QtSql>
    3. #include <QDebug>
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QCoreApplication a(argc, argv);
    8. QSqlDatabase db=QSqlDatabase::addDatabase("qmysql","db");
    9. db.setHostName("testmysql");
    10. db.setDatabaseName("testdb");
    11. db.setUserName("vanduongbk");
    12. db.setPassword("sa123");
    13. if(!db.open())
    14. {
    15. qDebug()<<"error connect"<<db.lastError().text();
    16. }
    17. else
    18. {
    19. qDebug()<<"connected";
    20. }
    21. //MainWindow w;
    22. // w.show();
    23.  
    24. return a.exec();
    25. }
    To copy to clipboard, switch view to plain text mode 

    when compile,it have error as :
    Starting C:\Documents and Settings\vanduongbk\My Documents\myqtproject\build-mysqlproject1-Desktop-Debug\debug\mysqlproject1...
    QSqlDatabase: qmysql driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL QODBC3 QODBC QPSQL7 QPSQL
    error connect "Driver not loaded Driver not loaded"

  2. #2
    Join Date
    May 2010
    Posts
    19
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: mysql is installed but can not load

    Have a look at
    http://www.qtcentre.org/threads/2066...ill-not-loaded
    if it solves your problem

Similar Threads

  1. Replies: 6
    Last Post: 4th March 2013, 20:20
  2. Replies: 3
    Last Post: 22nd February 2013, 12:05
  3. Qt Creator App launched by run option does not load mysql driver
    By l0ud in forum Qt Tools
    Replies: 0
    Last Post: 19th September 2012, 18:48
  4. cannot load mysql driver
    By saman_artorious in forum Qt Programming
    Replies: 1
    Last Post: 9th July 2012, 01:08
  5. MYSQL 5 Table qt model as small Mysql admin
    By patrik08 in forum Qt-based Software
    Replies: 0
    Last Post: 1st May 2007, 09:43

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.