Python Forum
PyQt5 MySQL Drivers Not Loaded
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyQt5 MySQL Drivers Not Loaded
#8
(Aug-05-2021, 07:38 PM)deanhystad Wrote: How about posting your code before you give up. Maybe you are making a little mistake that is easy to fix.

Hi i deanhystad - you're right to ask for the snippet. Been banging my head against
a wall and jus got frustrated. see code snippet below (i'm trying to test the connection object):

from PyQt5 import QtSql
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtSql import *

import sys

def search():

    mydb = QtSql.QSqlDatabase.addDatabase("QMySQL")
    mydb.setHostName("localhost")
    mydb.setUserName("root")
    mydb.setPassword("pioneer1")
    mydb.setDatabaseName("FriqueDB")
    mydb.open()

    if mydb.open():

        print('database is opened')
    else: print('database not opened')

btn1 =QPushButton(win)
btn1.setText('Search')
btn1.move(370,210)
btn1.show()
btn1.clicked.connect(search)


win.show()

sys.exit(app.exec_())
This is the output:

Error:
QSqlDatabase: QMySQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
Reply


Messages In This Thread
PyQt5 MySQL Drivers Not Loaded - by AdeS - Aug-04-2021, 08:40 PM
RE: PyQt5 MySQL Drivers Not Loaded - by mesbah - Aug-04-2021, 09:01 PM
RE: PyQt5 MySQL Drivers Not Loaded - by AdeS - Aug-04-2021, 09:08 PM
RE: PyQt5 MySQL Drivers Not Loaded - by mesbah - Aug-04-2021, 09:24 PM
RE: PyQt5 MySQL Drivers Not Loaded - by AdeS - Aug-04-2021, 10:09 PM
RE: PyQt5 MySQL Drivers Not Loaded - by AdeS - Aug-05-2021, 07:08 PM
RE: PyQt5 MySQL Drivers Not Loaded - by deanhystad - Aug-05-2021, 07:38 PM
RE: PyQt5 MySQL Drivers Not Loaded - by AdeS - Aug-06-2021, 08:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unexpected termination of program when using JDBC drivers in python with jaydebeapi skarface19 2 338 Feb-17-2024, 12:01 PM
Last Post: skarface19
  Mysql and mysql.connector error lostintime 2 687 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Is Matplotlib.pyplot Loaded DaveG 2 1,330 Apr-06-2022, 06:12 AM
Last Post: DaveG
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,131 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  "ModuleNotFoundError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package" chipx 3 7,480 Dec-09-2021, 07:05 AM
Last Post: chipx
  Package cannot be loaded into PBS queue file emersonpl 1 1,840 Sep-09-2021, 08:06 PM
Last Post: emersonpl
  MacOS BigSur Python3 - dyld: Library not loaded: trillionanswers 1 4,219 Mar-02-2021, 11:00 PM
Last Post: nilamo
  Why is mpl_toolkits loaded? Gribouillis 1 1,619 Jan-30-2021, 08:39 PM
Last Post: Serafim
  start interactive pyhton shell with pre-loaded custom modules Viktor 2 2,211 Apr-09-2020, 08:25 AM
Last Post: Viktor
  external refs by libraries loaded with cdll caldodge 0 1,514 Jul-01-2019, 10:26 PM
Last Post: caldodge

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020