Use this tag for questions about the MySQL-Python database connector library (MySQLdb). Do not use this tag for questions about MySQL Connector/Python (use the [mysql-connector-python] tag instead).

learn more… | top users | synonyms (1)

0
votes
0answers
24 views

MySQL django backend unknown system variable

I have the following in my settings DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'OPTIONS': { 'read_default_file': '/etc/django/mysql_client.cnf' ...
0
votes
1answer
7 views

Installing MySQLdb on osx El Capitan for Python

I am trying: brew install mysql pip install mysql-python I am getting this output: Collecting mysql-python Using cached MySQL-python-1.2.5.zip Installing collected packages: mysql-python Running ...
4
votes
2answers
353 views

mysqldb converts timestamp data to None

I am using MySQLdb to talk to mysql database and I am able to retrieve dynamically all the result sets. My problem is that once I get the result set, there are a couple columns which are declared as ...
5
votes
3answers
3k views

set up a MySQLdb connection object for multiple databases

This question is likely noobish. Instead of hardcoding the MySQLdb connection object: e.g, db = MySQLdb.connect('localhost','name','pwrd','db_name') How do I set it up so I can specify the db_name ...
0
votes
1answer
22 views

Python3.4 int object is not iterable - MySQLdb

I'm running python3.4 and i'm trying to run a query with the MySQLdb library. I've done one successful query but now I am stuck when it comes to integers in a query. Here's the code: ...
2
votes
0answers
24 views

On LOAD DATA LOCAL INFILE integer required error

I have a data file containing data in following format asd,12,asd,asd,12,adsd,,asdas,None I have a table in mysql which is has an auto increment int id and the rest of the columns as in data file. ...
2
votes
1answer
36 views

server crash after my python script start to working

i have a python script that listen to tcp port and after received data and a small string processing save data in mysql database: script running and start working really good but after a while , at ...
6
votes
4answers
17k views

Access Denied for MYSQL ERROR 1045

I just got a new macbook pro (OS X 10.8.2) and am attempting to get mysql set up on it. So far I've been able to get it installed but I cannot get my root user access (or any user for that matter). I ...
0
votes
1answer
28 views

Using a variable as field name in MySQLdb, Python 2.7

This works when I replace the column variable with an actual column name. I do however need a variable. When I use a variable I get a MySQL syntax error. Can a field be a variable? If so, where is the ...
-2
votes
1answer
27 views

Error Inserting data to mysql server through mysqldb in python

MYsqldb is returning 1L when executing this:- db=MySQLdb.connect('localhost','root','12345678','kitkat') cur=db.cursor() cur.execute("INSERT INTO justdial(id,email_raw,status) VALUES (NULL,'none','...
459
votes
4answers
291k views

Installing specific package versions with pip

I'm trying to install version 1.2.2 of the MySQL_python adaptor. The current version shown in PyPi is 1.2.3. Is there a way to install the older version? I found an article stating that this should do ...
0
votes
1answer
31 views

how to for each the data that return by python3.5 from mysql

I use python3.5 and connect mysql to get the data. and I don't know how to get the data of each column without the way of creating a Model. # encoding=utf-8 import mysql.connector HOST = 'localhost' ...
3
votes
1answer
38 views

ImportError: No module named _mysql

I'm trying to use the Python module MySQL-python to connect to an external MySQL database from an AWS EC2 instance running amazon linux. This is the code I'm trying to run: db=_mysql.connect(host="...
1
vote
2answers
2k views

How can I use Conda to install MySQLdb?

I've read several different explanation regarding how to install MySQLdb, but I'm not sure which case applies to me since my error message is different. My system can't seem to find MySQLdb. I ...
0
votes
0answers
17 views

How do I get values from a form in Python?

I should get values from a form and insert them in a database. So this is my code. When I test via a browser, it does not work. I check in the database and the table but has no values. Kindly note I ...
38
votes
5answers
17k views

Print the actual query MySQLdb runs?

I'm looking for a way to debug queries as they are executed and I was wondering if there is a way to have MySQLdb print out the actual query that it runs, after it has finished inserting the ...
0
votes
0answers
5 views

Plone 3 - install MySQLdb and ZmySQLDA

Anyone knows how to install/import those library and I already post a thread on plone community but only 1 commented "He says that I should switch to linux" but I need to install it on Windows 7
24
votes
5answers
18k views

Database does not update automatically with MySQL and Python

I'm having some trouble updating a row in a MySQL database. Here is the code I'm trying to run: import MySQLdb conn=MySQLdb.connect(host="localhost", user="root", passwd="pass", db="dbname") cursor=...
4
votes
2answers
2k views

MySQLdb and Python ImportError

I cannot for the life of me figure this one out. I've been searching around the web all day and all the resources seem terribly out dated. From what I can tell getting MySQLdb and Python to play nice ...
1
vote
0answers
63 views

MySQL with Django - Python

I'm integrating MySQL as backend with my Django application. At the time of installation i'm running following command (using mac os) export PATH=$PATH:/usr/local/mysql/bin start server from settings ...
3
votes
2answers
10k views

EnvironmentError: mysql_config not found

EnvironmentError: mysql_config not found, while installing MySQL-python Could someone advice me on what to do? I did the following from my-side: Error I got while installing with pip: ubuntu12....
3
votes
3answers
8k views

Windows Python2.7 mysqldb installation error

I'm trying to install mysqldb for Python. I'm running "pip install mysql-python" and I keep getting this error: running build_ext building '_mysql' extension creating build\temp.win32-2.7 ...
0
votes
1answer
27 views

Python MySQL Bulk Insertion Error with Character Encode

I Start new Project in Python with MySQL. I just try to insert millions of record from CSV to MySQL through MySQLdb package. My Code: import pandas as pd import MySQLdb #Connect with MySQL ...
0
votes
1answer
30 views

TypeError: 'connection' object is not callable in python using mysqldb

from flask import Flask from flask_restful import Resource, Api from flask_restful import reqparse from flask_mysqldb import MySQL mysql = MySQL() app = Flask(__name__) # MySQL configurations app....
0
votes
0answers
34 views

Python SqlAlchemy | Error On Create Table

I'm a beginner of "Python with SqlAlchemy". I try the following to create the table in "MySQL" Database. My Code is : import pandas as pd from sqlalchemy import create_engine from sqlalchemy ...
1
vote
0answers
23 views

Specifying dtypes for read_sql in pandas

I would like to specify the dtypes returned when doing pandas.read_sql. In particular I am interested in saving memory and having float values returned as np.float32 instead of np.float64. I know ...
19
votes
4answers
52k views

Python MYSQL update statement

I'm trying to get this Python MYSQL update statement correct(With Variables): cursor.execute ("UPDATE tblTableName SET Year=%s" % Year ", Month=%s" % Month ", Day=%s" % Day ", Hour=%s" % Hour ", ...
0
votes
1answer
39 views

ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb — Django 1.4 & Google App Engine

This will be the second time in my life posting about almost exactly the same thing. The difference between this time and last time is about 9 months, lots of difficult learning, and the fact that for ...
0
votes
0answers
11 views

Data is not storing properly in python sqlalchemy

I am starting with Python Flask to buid application but getting errors during api call. how can i solve this issue . My api.py from flask import Flask , render_template , flash , request, redirect ...
2
votes
0answers
65 views

“Can't initialize character set utf8mb4” with Windows mysql-python

I'm getting an error try to connect to a remote mysql database from a Windows 7 client via python 2.7 + MySQLdb 1.2.5 + sqlalchemy 1.0.9. This is a result of recently changing the server's default ...
0
votes
4answers
818 views

Python and MySQLdb warnings

I have a program that is exporting MSSQL data and importing it into MySQL. I have a function that is importing as follows: def importMySql (mycursor,exportedfilename,table,delimiter): file_loc = ...
0
votes
0answers
22 views

Is it possible to get the execute summary after run python MySQLdb

all, In bash, when we run a mysql query with -svve, then we can get a summary of the execution of the query as below: query="update ..." mysql -svve"$query" result/summary after run the script ...
0
votes
1answer
17 views

bypass known exception of mysql in python

I am trying to bypass "Cannot delete or update a parent row: a foreign key constraint fails" inside my python script. So I am planning to drop all tables but this error throws up due to inter ...
1
vote
1answer
60 views

Using MySQLdb Python module with mysql_old_password

I need to use Python to connect to a database that uses the mysql_old_password authentication plugin. I do not have db admin access so I cannot change this setting, so please do not suggest that. I ...
4
votes
2answers
2k views

MySQLdb Stored Procedure Out Parameter not working

I have a database hosted on Google Cloud SQL, and a python script to query it. I am trying to call a Stored Procedure that has an Out Parameter. The SP is called successfully, but the value of the ...
-2
votes
2answers
57 views

truncated incorrect value

I have a python code that displays a range of dates. In the code below I have passed the dates in the select operation by casting the dates and using STR_TO_DATE function. I want to know how a range ...
0
votes
1answer
21 views

ConfigParser.NoSectionError: No section: 'metadata' in installing mysql-python

When I try install mysql-python to CentOs6.5 it casts a error python /sw/ple.bkp/workspace/tianfd/TEMP/MySQL-python-1.2.5/setup.py install Traceback (most recent call last): File "/sw/ple.bkp/...
1
vote
2answers
957 views

Failed pip install mysql-python

I am running this in Windows environment using python version 2.7, while running below will give error, running pip install mysql-python for the testproject will give similiar error too. I tried ...
0
votes
2answers
149 views

MySQL-python error

I have downloaded MySQL-python connector and installed it using $ sudo python setup.py install. While importing that package from python shell, following error is raised. Please help me out. ...
39
votes
14answers
44k views

“Cannot open include file: 'config-win.h': No such file or directory” while installing mysql-python

I'm trying to install mysql-python in a virtualenv using pip on windows. At first, I was getting the same error reported here, but the answer there worked for me too. Now I'm getting this following ...
0
votes
1answer
28 views

can a return value of a function be passed in the where clause

I have a python code that displays a list of station ID and air temperature for certain number of days. In the code below I have passed the dates as a list. But that is cumbersome coding since I have ...
0
votes
1answer
22 views

How do i fetching the image from the mysql database

Please give me some image fetching particular code which is help me to fetching the image from mysql database.I already store the image blob data into a database and then fetching it,but only ...
1
vote
3answers
35 views

Getting Error while building mysql for python on Mac OS X El Capitan

I read some of the related topics and tried to implement those solutions to my situation but still I get the following error after this command : (project2_env) Efe-MacBook-Air:MySQL-python-1.2....
0
votes
0answers
48 views

error installing mysql-python and none of mentioned solutions worked

I just wanted to install Mysql-python, but every time errors occur. I have tried all mentioned solutions as installing wheel, using easy_install, renewing visual c++ for python, installing mysql ...
1
vote
0answers
23 views

Can't connect to MySQL server (111) even after changing bind-address

I wrote a few lines of code that sends data to a remote MySQL database. import MySQLdb db = MySQLdb.connect("MyServerIP","MyUserName","MYPwd","MyDB") # prepare a cursor object using cursor() method ...
0
votes
4answers
36 views

Synax error on db.close()

Im trying to use mysqldb in a python script. Here is a part of the code from the script cursor = db.cursor() sql = """INSERT INTO location(`name`, `lat`, `long`, `guid`, `image`, `date`)VALUES(%...
1
vote
1answer
27 views

Flask-MySQLdb raises _mysql_exceptions.ProgrammingError: closing a closed connection

I'm trying to use Flask-MySQLdb. Every time I go to a page I get the error _mysql_exceptions.ProgrammingError: closing a closed connection. Why isn't this working? from flask import Flask, ...
0
votes
0answers
31 views

Error loading MySQLdb

I'm facing problem while connecting mysql database in django. I'm getting error as raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)django.core.exceptions.ImproperlyConfigured: ...
-1
votes
1answer
31 views

Insert Ordered Dict values while using MySQL INSERT INTO

I encounter this error when I'm trying to insert some values into a table. Here's my code: def tsx_insert(self, d_list): for item in d_list: query = """ INSERT IGNORE INTO tsx_first_insert(...
9
votes
2answers
4k views

Fastest way to load numeric data into python/pandas/numpy array from MySQL

I want to read some numeric (double, i.e. float64) data from a MySQL table. The size of the data is ~200k rows. MATLAB reference: tic; feature accel off; conn = database(...); c=fetch(exec(conn,'...