564 questions
2
votes
0
answers
119
views
AttributeError: module 'mysql.connector' has no attribute 'CMySQLConnection'
I'm trying to get MySQL connector working in VScode, have used pip install mysql-connector-python to install it which seems to have worked but whenever I try to use from mysql.connector I get
...
0
votes
0
answers
81
views
"The kernel appears to have died. It will restart automatically. " Error that appeared when I tried to connect Jupyter notebook with MySQL workbench
The following is the code block that I tried to execute:
import mysql.connector
cnx = mysql.connector.connect(
host="127.0.0.1",
port=3306,
user="root",
password=&...
0
votes
0
answers
95
views
Why does PyQt5 crash on mysql.connector.connect() even though it works separately?
I am developing a ToDo application in Python 3.13.1 with GUI in PyQt5 and connection to MySQL database via mysql-connector-python.
When I run main.py, the application instantly crashes (without even ...
0
votes
0
answers
97
views
Python MySQL Connection Hangs Using mysql-connector-python
My Python script hangs when trying to connect my Flask app to a MySQL database using mysql-connector-python. The MySQL server is running because it runs perfectly in VSCode, but I can't connect via ...
0
votes
1
answer
442
views
Why mysql.connector is not working, although pymysql is working to connect database locally?
I tried to connect my MySQL database from a Python script using mysql.connector, but could not be able to connect. Then I tried to connect using pymysql and the db was connected successfully. Why am I ...
1
vote
2
answers
533
views
Python crashes exit code 0xC0000005 (Access Violation) on mySQL Connection request
I created a new Windows 11 VM with mySQL and PyCharm installed. To test connectivity from Python to mySQL, I created the following program.
print('Start mySQL Query test')
import mysql.connector
print(...
0
votes
0
answers
58
views
Where in a MySQL statement can I use pyformat variables/parameters?
Here's an example that doesn't work:
stmt = '''
SELECT `date_new`, `event`
FROM `events`
WHERE `date_new` > TIMESTAMP(DATE_SUB(NOW(), INTERVAL %(days)s day))
'''
args = {'days': 30}
c....
0
votes
1
answer
58
views
I can't see if my python-mysql connection is active
I'm using python and I'm trying to make a connection to a MySQL db. The problem is that when I run this code:
import mysql.connector
print('Attempting connection to database...')
con = mysql....
0
votes
3
answers
359
views
mysql.connector.connect failing to connect
While trying to connect Python with SQL, it just does not work, with no errors, the execution stops itself, here's the code:
import mysql.connector
def appen():
print('k')
mysq = mysql....
-3
votes
1
answer
809
views
RuntimeError: Failed raising error. Mysql-connector-python
connection = mysql.connector.connect(
host=ip,
user=user,
password=password)
Hello. I use mysql-connector-python https://pypi.org/project/mysql-connector-python
...
0
votes
3
answers
877
views
Mysql connector for python appears to be crashing, how can I diagnose the problem?
The following code is expected to print, "A", "B", and "C":
print ("A")
import mysql.connector
print("B")
mydb = mysql.connector.connect(
host="...
0
votes
1
answer
85
views
Python MySQL connector segmenation fault on Windows
I have a clean system and installed Python and mysql-connector-python via pip. But as soon as I add attributes to
mysql.connector.connect
I get a segfault.
So just
mysql.connector.connect()
works ...
0
votes
1
answer
533
views
Why can my Pyinstaller EXE not find mysql_native_password from mysql-connector-python?
When compiling my application that includes mysql.connector with pyinstaller, attempting to make a database connection in the exe results in this error:
Traceback (most recent call last):
File "...
1
vote
1
answer
359
views
How to test that MYSQL-Connector-Python is working correctly?
Situation
I am trying to troubleshoot my issue between Python and MYSQL. I have found myself in a situation where I am temporarily forced to develop on a Windows 11 machine. I am not sure if that is ...
0
votes
0
answers
46
views
import mysql.connector not working MacOS 15.1.1 - Python 3
I have a python3 file:
from flask import Flask, request
import mysql.connector
db = mysql.connector.connect(
host="*host*",
user="*user*",
password="*password*&...
0
votes
0
answers
83
views
mysql-connector-python error No module named 'mysql.connector.plugins.mysql_native_password'
I am using Mysql server: 10.5.19-MariaDB-0+deb11u2
installed mysql-connector-python, tried many versions from 8.1 to 9+
When my python code reaches the line mysql.connector.connect()the below ...
-1
votes
1
answer
1k
views
restart:shell as output when trying to connect mysql with python [duplicate]
import mysql.connector
mydb = mysql.connector.connect(host="localhost", user="root", password="123456")
if mysql.connector.is_connected():
print("connected")...
-1
votes
2
answers
1k
views
no output when connecting mysql local database with python programme
When i am using mysql.connector library to connect mysql local database with my python programme and when i am running it there is no out in my shell .What should i do please help.
This my code:
...
0
votes
1
answer
59
views
"Not all parameters were used in the SQL statement" when inserting values from file to database
I get an error when trying to insert into the database table with the following code
import mysql.connector
import re
mydb = mysql.connector.connect(
host="",
user="",
...
0
votes
1
answer
69
views
Custom cursor_class does not work with dictionary attribute - LoggingCursor
I am using mysql-connector-python==9.0.0 and need a custom cursor class. By default, I used:
cursor = db.cursor(dictionary=True)
This returns data as a dictionary instead of a tuple (which is the ...
0
votes
0
answers
499
views
mismatch between python 3.12 and mysql-connector-python 8.0.15. how can i uninstall connector python 8.0 and install the 8.4 on ubunto
i have ubunto 24.04 lts on my system and python 3.12. i have installed connector/python 8.0.15 and i cant to connect my database.
import mysql.connector
cnx = mysql.connector.connect(user='root', ...
0
votes
1
answer
81
views
Flask API silently dies during cursor.execute
I've got a simple Flask API used for fetching data from different databases for display within a react app. I recently put out a new version of the API which seems to have broken it, although I'm not ...
0
votes
1
answer
96
views
How to Fix Character Encoding Issues in Flask App with MySQL Database
I'm working on a project that involves a MySQL database and a Flask app in Python. I establish a connection to MySQL and query data using the cursor.execute method. However, I'm encountering strange ...
0
votes
2
answers
66
views
I can't save the data encrypted with the AES_ENCRYPT function
I need to store very important information, and for greater security, I decided to use the built-in MySQL function "AES_ENCRYPT", but while saving data in the table, I get the following ...
0
votes
2
answers
128
views
My flask application requires to be restarted to display new database records
I am working on a application. I am using HTML, CSS, Jquery, Flask, MySQL-Python-Connector, Flask-Session. The data will be pushed into the database by some other application and this interface will ...
1
vote
0
answers
46
views
Python mysql.connector commands out of sync; you can't run this command now when executing stored proc
I am calling a function that uses a db cursor twice to retrieve data and pass it to an html file.
@app.route("/EditSubjects", methods = ["POST"])
def editSubjects():
if session....
1
vote
1
answer
333
views
How can I connect an up-to-date django server to a MySQL 5.1 database? (upgrading the MySQL version is not an option)
I have a MySQL-server that is part of a software system that is not developed by me. Thus it is not possible for me to upgrade that MySQL-server to a newer version, because it might break the software ...
0
votes
1
answer
53
views
Python MySQL: Unexpected response on split query
I'm getting different responses depending on wether I run the query in an "all in one" query or if I run them separately.
I can't for the life of me figure out what I'm doing wrong.
Code:
...
-1
votes
1
answer
102
views
python mysql connector gives incorrect result
This python code:
import mysql.connector
try:
conn = mysql.connector.connect(
host="localhost", user="fanw", password="secret", database="fanw"
...
0
votes
1
answer
116
views
Unable to execute mysql script - 'CREATE FUNCTION' or 'CREATE TRIGGER' via Python
I do have troubles with my sql scripts which I've wrote priorely and try to read with my python code and also execute it. Here my simple mysql script, where the DELIMITER command is removed:
DROP ...
0
votes
1
answer
162
views
How to connect to MySQL Workbench Database using PyCharm?
I am trying to connect to a MySQL database through Python using PyCharm. I am using the following code.
from errno import errorcode
import pandas as pd
import pypyodbc
import mysql.connector
from ...
2
votes
4
answers
6k
views
pip install mysqlclient fails with "call to undeclared function" error
I am currently on macOS 14.3 on Apple silicon. I am trying to install mysqlclient using pip. I already have mysql package installed using brew install mysql pkg-config but my mysqlclient installation ...
1
vote
1
answer
124
views
Release a Python application using MySQL Connector for database without the user having to install MySQL?
I have created a CLI app in Python, a sort of library management system that uses a MySQL database to store records. If I wanted to release this as an installable app, could I do it without the end-...
0
votes
1
answer
169
views
How to prevent pymysql (or mysql.connector) resolving localhost to IPv6?
I am trying to connect to MySQL from Python on my hosting provider's server. I have my database created, I can connect to it through SSH and with PHP. When I try to connect using Python I get an error ...
0
votes
2
answers
582
views
SQL Injection in Stored Procedures via MySQL Connector
I use the mysql-connector-python driver for executing database operations. Recently, I came across stored procedures in MySQL and decided to migrate some of my APIs from utilizing cursor.execute() to ...
0
votes
0
answers
473
views
Spyder has encountered an internal problem. What steps will reproduce the problem?
My code has no errors, I tried this same code on a different computer (it worked there) but here in my pc it isn't running. the following is a part of my code:
import pandas as pd
import mysql....
0
votes
0
answers
114
views
Can't use mysql.connector
I started to watch this cool guy's flask lessons (https://www.youtube.com/watch?v=0Qxtt4veJIc&list=PLCC34OHNcOtolz2Vd9ZSeSXWc8Bq23yEz). I got stuck on 9th lesson, where I need to create a MySQL ...
0
votes
1
answer
329
views
With MySQL Connector in Python how do I create a stored procedure then use it right away?
Using mysql-connector in python, I'm trying to create a stored procedure and then create another one which calls the first with this code :
def ExecuteQueryFromFile(query_name, path):
try:
with ...
-1
votes
1
answer
96
views
Cannot get data from MySQL database
down below is my code to get some data from MySQL for my Discord Bot:
import traceback
import mysql.connector
DB_CONFIG = {
'host': 'mydomain',
'port': 3306,
'user': 'user',
'password':...
0
votes
2
answers
441
views
Python TypeError: 'Field' object is not callable: msql-connector-python
Problem: Executing a certain UPDATE query using the 'mysql-connector-python' library causes a TypeError during utf8 encoding.
Packages in my project:
colorama==0.4.6
iniconfig==2.0.0
mysql-connector-...
2
votes
0
answers
98
views
MySQL 8 inserting spatial POINT data (gps) using placeholders, not possible?
I'm trying co insert rows into a table, one column of which is GPS coordinates. Rows will later be selected based on their distance from a given set of coordinates, so I want to use the POINT data ...
0
votes
2
answers
51
views
What is causing rounding errors when querying data from MySQL in python
I'm querying data from a table(schema and example data below) in mysql(mysql-connector-python). In this table I have two float values "ourCostPerSegment" and "theirCostPerSegment" ...
0
votes
1
answer
366
views
Requested Module was not found: No module named 'mysql.connector.plugins.caching_sha2_password'
I have converted my test.py file to test.exe file using pyinstaller :pyinstaller --onefile --hidden-import mysql.connector.plugins.caching_sha2_password test.py but this it gives me the following ...
2
votes
1
answer
160
views
Sleep() not working with stacked query in mysql-connector-python
I am working on creating a security based CTF application in Django. The current exercise I am building is a blind time-based sql injection. As Django does not appear to support stacked queries ...
1
vote
0
answers
792
views
Always getting "unread result found" error in python SQL in first iteration of loop
I am using mysql-connector-python 8.0.33 and tring to fetch all records from database using following code .
def retrieve_records():
try:
cursor = conn.cursor(buffered= True)
...
31
votes
11
answers
42k
views
Docker Alpine build fails on mysqlclient installation with error: Exception: Can not find valid pkg-config name
I'm encountering a problem when building a Docker image using a Python-based Dockerfile. I'm trying to use the mysqlclient library (version 2.2.0) and Django (version 4.2.2). Here is my Dockerfile:
...
-1
votes
1
answer
1k
views
How can I access data in a database on a hosted website using a python application?
The project I'm working on is in two parts. The first is a website, written in native HTML/CSS/PHP/JS, with a MySQL database.
For the second part, I've been asked to create a python application that ...
0
votes
1
answer
242
views
Connection Pool blocking threads
I have a class that subclasses a Thread, and I'm having trouble creating objects with mySQL connections inside it asynchronously. Each MyObject has a mysql connection pool that is created on __init__. ...
0
votes
0
answers
116
views
Has there been a change to the way that mysql-python-connector works when using executemany to insert a large list of tuples into a database table?
I'm executing the following code to insert a list of tuples into a mysql database using the mysql-connector-python package.
import mysql.connector
import random
from time import time
# Create a list ...
0
votes
2
answers
125
views
Android Studio: InterfaceError: 2003: Can't connect to MySQL server on '192.168.137.1:3306'
I am new to this technology. But currently I am working on a project on Android which has an integrated module where I use Python code because I need to implement ML to fetch some data from MySQL ...