Results 1 to 4 of 4

Thread: Mysql unknown database, QMYSQL unable to connect

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Mysql unknown database, QMYSQL unable to connect

    Dear all,

    I just downloaded Qt 4.6.1 installer for windows (VC++ 2008), and I would like to create and use QMYSQL.
    I tried all sql examples with QSQLITE and they worked, then I downloaded MySql 5 installer, I built the *.dll qt plugin,
    but I can't open/create a new database from scratch.
    My code is the following:

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    2. db.setUserName("root");
    3. db.setPassword("pass");
    4. db.setDatabaseName("test.mysql"); //I would like to create a new database, locally on my pc
    5. if (!db.open()) return false;
    To copy to clipboard, switch view to plain text mode 

    And I'm getting: Unknown database 'test.mysql' QMYSQL: unable to connect.

    Any kind of help is appreciated,
    Thank you very much.

  2. The following user says thank you to lixo1 for this useful post:


Similar Threads

  1. how to reconnect CORRECTLY qmysql database?
    By yaseminyilmaz in forum Newbie
    Replies: 7
    Last Post: 12th January 2010, 13:09
  2. how to reconnect CORRECTLY qmysql database?
    By yaseminyilmaz in forum Qt Programming
    Replies: 0
    Last Post: 31st December 2009, 12:20
  3. QT 4.5 QMYSQL and Mysql 4.1 servers does not work
    By elektritter in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2009, 15:53
  4. ODBC Oracle. Unable to connect to database
    By egil in forum Qt Programming
    Replies: 2
    Last Post: 17th October 2008, 13:46
  5. Issues regarding QMySql drivers and mysql database
    By bera82 in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2006, 17:50

Tags for this Thread

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.