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).
0
votes
0answers
8 views
mac mysqldb “import MySQLdb”,but show “ImportError”
mac 10.11osx,and mysql5.5 python 2.7(system) mysqldb1.2.5,but when i do "import MySQLdb",it wrong----------
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (...
-1
votes
2answers
33 views
Django python server “Can't connect to MySQL server on '127. 0.0.1' (10061)” while it was able to connect yesterday? [on hold]
My python runserver isn't able to connect to my mysql server even though my MySQL service is running and I was able to connect yesterday on this machine.
My runserver error:
super(Connection, ...
0
votes
0answers
4 views
why can't use cursor as a parameter in multiprocessing
I found cursor used as parameter will cause error when execution if I call the function as a process.
But it works fine if I call the function directly.
I guess it is multiprocessing that causes ...
2
votes
1answer
637 views
Hook available for automatic retry after deadlock in django and mysql setup
I am using innoDB table in Django with mysql database. During investigation of error
OperationalError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
I came across ...
0
votes
3answers
61 views
Most efficient way to iterate through list of lists
I'm currently collecting data from quandl and is saved as a list of lists. The list looks something like this (Price data):
['2', 1L, datetime.date(1998, 1, 2), datetime.datetime(2016, 9, 26, 1, 35, ...
-1
votes
0answers
14 views
Error “Unable to find vcvarsall.bat” when installing MySQLdB with pip [duplicate]
I am trying to install MySQLDB through pip command but it is showing following error. What am I missing here?
building '_mysql' extension
error: Unable to find vcvarsall.bat
---------------------...
1
vote
0answers
25 views
Cannot connect to remote MySQL server from Jupyter Notebook environment
I have a Python 2.7 script that connects to a remote MySQL database using MySQLdb. I don't have any local MySQL server on my laptop and for the purpose of this script I don't need one. I am on Windows ...
5
votes
2answers
3k views
TypeError: unsupported operand type(s) for +: 'decimal' and 'float'
I am using Python 2.7 and MySQLdb. I get this error on this code:
Value = 5
x.execute("SELECT number from Testing where id ='%s';" % Value)
data = x.fetchall()
print (data)
data = data[0][0]
data = ...
0
votes
0answers
11 views
is it possible to work with mysql document store from a python/django project
I am new to mysql document store. I can work with it from the shell but i would like to work from a python/django project.
It seems there are no library for managing document store from python. How ...
-1
votes
1answer
50 views
MysqlDb and Pyqt4 comparing variables
I have a database in mysql, and I'm working in a app in QT4, I'm using Mysqldb connector, I'm already successfully connected to the database, but when I'm querying the table t_usuarios I don't know ...
0
votes
2answers
29 views
MySQLdb Executemany error
I'm having issues with executemany returning the following error
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to ...
0
votes
1answer
23 views
PyCharm import MySQL
I am trying
import MySQLdb as mdb
on PyCharm and get the error:
ImportError: No module named MySQLdb
From the PyCharm-preference, cannot find MySQLdb to import.
pymysql was successfully ...
3
votes
1answer
2k views
Django - Can we make a connection to different remote database
I am writing a Django application where I already have 1 mysql backend db configured in my settings.py.
I know we can add as many db configurations as we want, but that's hard coding which I don't ...
1
vote
2answers
12 views
Select single item in MYSQLdb - Python
I've been learning Python recently and have learned how to connect to the database and retrieve data from a database using MYSQLdb. However, all the examples show how to get multiple rows of data. I ...
0
votes
0answers
19 views
Python/MYSQLdb memory issues
I am running a script that is writing to a mysql database in the rough form of:
import MYSQLdb
import pandas as pd
def mysql_function():
db = MySQLdb.connect(host=something, user=something, ...
1
vote
3answers
410 views
Python MySQLdb “with” syntax and DictCursor
I'm trying to use a DictCursor with a with block. I would think that by using:
with MySQLdb.connect(...) as c:
c would be a connection object, because that's what connect() returns. But alas, it ...
0
votes
1answer
7 views
How pip knows what path to include when compiles?
I am trying to install MySQL-python with pip for 64-bit python. For this I want to use MySQL Connector C 6.0.2 which installed under c:\Program Files\MySQL\, but pip tries find it in -IC:\Program ...
0
votes
1answer
32 views
python SQL query insert shows empty rows
I am trying to do a insert query in the SQL. It indicates that it succeed but shows no record in the database. Here's my code
conn = MySQLdb.connect("localhost",self.user,"",self.db)
cursor = conn....
0
votes
0answers
36 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
23 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
379 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
31 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
26 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
39 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
18k 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
31 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
28 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','...
471
votes
4answers
300k 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
32 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
55 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
3k 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 ...
2
votes
0answers
76 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 ...
4
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
28 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
42 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
43 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
35 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
53k 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
68 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
97 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
859 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 ...