Results 1 to 3 of 3

Thread: PyQt5:QMYSQL driver not loaded

  1. #1
    Join Date
    Jun 2019
    Posts
    6
    Thanks
    1
    Qt products
    Qt5

    Default PyQt5:QMYSQL driver not loaded

    Hi,
    I got a problem on connecting database on my project.
    I use PyQt5.QSqlDatabase for connecting but a error occured.
    Qt Code:
    1. from PyQt5.QtSql import *
    2.  
    3. class Database():
    4. def __init__(self,hostname,user,dbase,pword=""):
    5. self.db=QSqlDatabase.addDatabase("QMYSQL")
    6. self.db.setHostName(hostname)
    7. self.db.setDatabaseName(dbase)
    8. self.db.setUserName(user)
    9. self.db.setPassword(pword)
    10. ok = self.db.open()
    11.  
    12. mydb=Database("localhost","root","billingsys")
    To copy to clipboard, switch view to plain text mode 

    Error is:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,590
    Thanks
    13
    Thanked 1,586 Times in 1,515 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: PyQt5:QMYSQL driver not loaded

    You need to build and install the Qt MySQL database plugin before QT or PyQT5 can load it.
    See here: QMYSQL for MySQL 4 and higher

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,313
    Thanks
    244
    Thanked 678 Times in 668 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: PyQt5:QMYSQL driver not loaded

    @Juliehannah: If you continue to post links to unrelated commercial web sites, I will report you as a spammer and ask for your username to be deleted. This is the only warning I'll give.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 3
    Last Post: 3rd June 2019, 09:59
  2. CentOS 6: QMYSQL driver not loaded, available driver: (none)
    By mp33919 in forum Installation and Deployment
    Replies: 1
    Last Post: 19th October 2016, 16:46
  3. QMysql Driver not loaded
    By Cerberus in forum Qt Programming
    Replies: 2
    Last Post: 1st November 2015, 20:55
  4. QMYSQL driver not loaded
    By robotics in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2011, 13:43
  5. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 21:15

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.