Results 1 to 8 of 8

Thread: PyQt5:QMYSQL driver not loaded

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2020
    Posts
    3
    Platforms
    Unix/X11 Windows

    Default Re: PyQt5:QMYSQL driver not loaded

    Quote Originally Posted by RamrajCh View Post
    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
    Hi, I have ran into same problem.I have looked almost every link which is a suggested solution to this but most of them are about QT not PyQT and none of them worked for me anyway.

    Did you find a solution to this ?? If so please help me.

    I am using Windows 10 OS, PyQt5.14.1, MySQL 8.0.19, mysql-connector-python 8.0.19.

    Please reply as soon as possible. I am stuck to this 2 last days.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt5:QMYSQL driver not loaded

    As ChrisW67 already said you have to build the driver on your own. Follow the instructions in link ChrisW67 gave above.

  3. #3
    Join Date
    Mar 2020
    Posts
    3
    Platforms
    Unix/X11 Windows

    Default Re: PyQt5:QMYSQL driver not loaded

    Quote Originally Posted by ChristianEhrlicher View Post
    As ChrisW67 already said you have to build the driver on your own. Follow the instructions in link ChrisW67 gave above.
    Correct me if I am wrong.
    Those are for Qt not for PyQt5. They used qmake but there is no file with name as qmake.exe or qmake.py in PyQt5 folder.

    I am using PyQt5 only not Qt.

    Can you guide me about how to build and install MYSQL driver for PyQt5 in windows 10 ?

    I did try to adding qsqlmysql.dll directly to ..Python37\Lib\site-packages\PyQt5\Qt\plugins\sqldrivers but that didn't work with error
    QMYSQL: driver not loaded, available driver QSQLITE, QMYSQL, QMYSQL3, ...

    I did find libmysql.dll and libmysql.lib in MYSQL SERVER folder but didn't find any link describing how to use them for PyQt5 in windows.

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt5:QMYSQL driver not loaded

    PyQt just uses the Qt libraries through a wrapper so I don't see why this should not apply to you...

  5. #5
    Join Date
    Mar 2020
    Posts
    3
    Platforms
    Unix/X11 Windows

    Default Re: PyQt5:QMYSQL driver not loaded

    Quote Originally Posted by adarsh1783 View Post
    Correct me if I am wrong.
    Those are for Qt not for PyQt5. They used qmake but there is no file with name as qmake.exe or qmake.py in PyQt5 folder.

    I am using PyQt5 only not Qt.

    Can you guide me about how to build and install MYSQL driver for PyQt5 in windows 10 ?

    I did try to adding qsqlmysql.dll directly to ..Python37\Lib\site-packages\PyQt5\Qt\plugins\sqldrivers but that didn't work with error
    QMYSQL: driver not loaded, available driver QSQLITE, QMYSQL, QMYSQL3, ...

    I did find libmysql.dll and libmysql.lib in MYSQL SERVER folder but didn't find any link describing how to use them for PyQt5 in windows.

    Thanks
    I uninstalled PyQt5 5.14.1 and installed PyQt5 5.12.1 and everything work fine.

Similar Threads

  1. Replies: 3
    Last Post: 3rd June 2019, 08: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, 15:46
  3. QMysql Driver not loaded
    By Cerberus in forum Qt Programming
    Replies: 2
    Last Post: 1st November 2015, 19:55
  4. QMYSQL driver not loaded
    By robotics in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2011, 12:43
  5. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 20: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.