3,184 questions
0
votes
1
answer
49
views
No connection to MySQL-database - PythonAnywhere/ Beginners Plan
Attempt to connect to MySQL-database by module MySQLdb fails and will be responded by: name 'MySQLdb' is not defined... in the servers log. Environment is not virtual, framework is Flask
The ...
0
votes
0
answers
51
views
Python 3 Flask MySQL connection and handle error
I am build a system include server, mobile app and desktop app.
server.py
from flask import Flask, jsonify, request, g, send_file
from flask_cors import CORS
import mysql.connector
import data.data as ...
0
votes
3
answers
363
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....
0
votes
0
answers
36
views
I am having a problem in MySQL connection in Python which I never had before [duplicate]
Traceback (most recent call last):
File "S:\Python\lib\site-packages\mysql\connector\network.py", line 733, in open_connection
self.sock.connect(sockaddr)
ConnectionRefusedError: [...
0
votes
0
answers
39
views
Wagtail django.db.utils.OperationalError: (1463, "Non-grouping field 'numchild' is used in HAVING clause")
I'm working on a Django project and I've encountered an issue that I'm unable to resolve. When I try to run my application, I get the following error:
django.db.utils.OperationalError: (1463, "...
0
votes
1
answer
86
views
Permission danied when reading file from /var/lib/mysql-files
I am using cursor.execute to generate the file my_file.csv and save it in /var/lib/mysql-files.
Here is my code:
import mysql.connector
connection = mysql.connector.connect(host='localhost', port='...
2
votes
0
answers
122
views
How do I use a loop to update the progress of my entire code in python using a progress bar
I have a code that pulls data from mysql database using python mysql connector and I want to create a progress bar in python using tkinter that shows query execution progress.
I have created a loop ...
1
vote
0
answers
55
views
SQLAlchemy difference between regular query and text
I am trying to insert new rows in a table that might already exist with constant values given from my application.
I have tried to create the following code:
with engine.begin() as con:
con....
0
votes
1
answer
616
views
Error installing mySQLDB using pip Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
Unable to run django application in the latest amazon Linux AL2023 running python3.9
It reports mySQLDB module is not installed, I tried installing mysql module using pip and yum but nothing helped to ...
0
votes
0
answers
102
views
UnicodeDecodeError when opening a .sql file using pandas read_sql_query
I need to analyze data from sql server. The process is memory heavy which requires me to use my university's computing resources as opposed my personal computer. Due to university policy, I cannot ...
0
votes
1
answer
732
views
Python 3.12 Connecting to local MySQL error
I've been using a Python script for a couple of years without a problem on Xubuntu 20.04, now on 24.04, I’m getting errors connecting to the MySQL server on the same machine.
Relevant code:
import ...
0
votes
1
answer
30
views
How to add value to a newly inserted column in sql using Python Mysql? [duplicate]
I am getting errors while inserting value to a newly added column.
import mysql.connector
mydb = mysql.connector.connect(
host = 'localhost',
username = 'rt',
password = 'rt',
database ...
0
votes
1
answer
67
views
MySQLdb installation issue on Mac. Required for MySQL connectivity with Django
I am creating a Django project on Mac. I want to use MySQL for database. I am trying to install MySQLdb which gives the following error:
(djangodev) $ pip3 install MySQL-python ...
0
votes
0
answers
85
views
MySQL Connector returning "None" when there is data
I'm using Python MySQL connector and I know there is a table named "users" in this db. I keep running into this issue no matter what I try (show tables, select * from users, etc). I even ...
0
votes
0
answers
101
views
In AWS, i had a RDS with active connections. I am able to retrieve no of active connections but not sure how to get those active details using python
In AWS, i had a RDS with active connections. I am able to retrieve no of active connections but not sure how to get those active details using python.
If i find the RDS has active db connections, then ...
0
votes
0
answers
76
views
Unable to get flask_mysqldb to work with python 3.x
I have a flask application that uses flask_mysqldb to connect with database. I had imported MySQLdb and flask_mysqldb packages to use. Some update today morning screwed this. I had to replace MySQLdb ...
6
votes
2
answers
2k
views
Pandas to_sql with SQLAlchemy cannot used to mysql
I have a problem with pandas to_sql in current version.
I already set create engine with SQLAchemy like this
db_url = "mysql+mysqlconnector://{USER}:{PWD}@{HOST}/{DBNAME}"
db_url = db_url....
0
votes
0
answers
978
views
import mysql.connector, ModuleNotFoundError: No module named 'mysql'
I am encountering an issue with a ModuleNotFoundError when trying to import the mysql.connector module in my Python script. I have already installed the module using pip install mysql-connector-python,...
-2
votes
1
answer
847
views
Django Python: AttributeError: 'NoneType' object has no attribute 'startswith'
I bumped into the error when running python3 manage.py runserver.
I have mydb.py in the project's root directory (same as manage.py), in order to connect to MySQL and create a database (if it does not ...
0
votes
0
answers
125
views
Flask App on Google App Engine Fails to Fetch Data from Cloud SQL with "500 Server Error"
I've developed a Flask app that communicates with a MySQL 5.7 database on Google Cloud SQL, with both the app and the database residing within the same Google Cloud Project. Locally, my app ...
2
votes
2
answers
3k
views
Installing mysqlclient to 3.12.1 python version
I already tried to install wheel -- didn't work well.
Tried to install build tools -- didn't work
Tried to install MySQL connector/C and put it in the environment variables -- didn't work
Tried ...
0
votes
0
answers
112
views
ModuleNotFoundError: No module named 'MySQLdb' in macOS 13.4
when I start the python application in macOS 13.4 with M1 chip, shows error like this:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1027, in ...
6
votes
1
answer
2k
views
How to install mysqlclient in a python:3-slim Docker image without bloating the image?
I'm using python:3-slim Docker image and want to use the mysqlclient package from Pypi but getting the following error from RUN pip install mysqlclient command:
...
Collecting mysqlclient
...
1
vote
0
answers
118
views
When exactly is a connection to MySQL server secure?
I'm trying to understand the exact meaning of SSL while trying to connect to a MySQL server (via mysql-connector-python). I have MySQL (v5.7) setup locally and I have 2 users. One (root) is the ...
0
votes
1
answer
78
views
Extracting MySQLdb column values within Flask
I am trying to program a simple dropdown where I do get data from the MySQLdb connection and cycle woth Flask through the resuls, but the data is not shown correctly. I have consulted and followed ...