mysql-python

Access Denied for MYSQL ERROR 1045

雨燕双飞 提交于 2019-11-27 23:06:10
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 plan on using this for Python , on my other computer I only use MYSQL (no MAMP) and I prefer to keep it that way. For reference, I did the following: $ alias mysql=/usr/local/mysql/bin/mysql $ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start $ alias mysqladmin=/usr/local/mysql/bin/mysqladmin When i enter mysql or mysql -u root -p it gives me this: ERROR 1045 (28000): Access denied for user 'root

Accessing a MySQL connection pool from Python multiprocessing

烂漫一生 提交于 2019-11-27 21:38:06
I'm trying to set up a MySQL connection pool and have my worker processes access the already established pool instead of setting up a new connection each time. I'm confused if I should pass the database cursor to each process, or if there's some other way to do this? Shouldn't MySql.connector do the pooling automatically? When I check my log files, many, many connections are opened and closed ... one for each process. My code looks something like this: PATH = "/tmp" class DB(object): def __init__(self): connected = False while not connected: try: cnxpool = mysql.connector.pooling

Python error: command '…\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2

孤人 提交于 2019-11-27 21:37:09
问题 I have some problems with python 3 module installing. I'm trying to install mysql using pip : python -m pip install mysql for python 3.4.4 and here is the error I get: error: command 'C:\\Program Files (x86\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2 here is a screenshot : screenshot of the error message I had other problems with module installation before, and I solved those by installing Visual Studio C++ 2010 Btw, the installation of other modules are working

ImportError: No module named MySQLdb

≯℡__Kan透↙ 提交于 2019-11-27 19:14:22
问题 I am referring the following tutorial to make a login page for my web application. http://code.tutsplus.com/tutorials/intro-to-flask-signing-in-and-out--net-29982 I am having issue with the database. I am getting an ImportError: No module named MySQLdb when I execute http://127.0.0.1:5000/testdb I have tried all possible ways to install python mysql, the one mentioned in the tutorial, easy_install, sudo apt-get install. I have installed mysql in my virtual env. My directory structure is just

python setup.py egg_info mysqlclient

牧云@^-^@ 提交于 2019-11-27 19:09:05
Trying to install mysqlclient using pip3 on Python 3.6.0 $ pip3 install mysqlclient Collecting mysqlclient Using cached mysqlclient-1.3.10.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "/private/var/folders/3k/08g3yx_12kg99kyfs989md600000gn/T/pip-build-1qv_89jc/mysqlclient/setup_posix.py", line 54, in get_config libraries = [dequote(i[2:]) for i

How to disable query cache with mysql.connector

拥有回忆 提交于 2019-11-27 15:11:07
I'm connecting mysql on my Kivy application. import mysql.connector con = mysql.connector.Connect(host='XXX', port=XXX, user='XXX', password='XXX', database='XXX') cur = con.cursor() db = cur.execute("""select SELECT SQL_NO_CACHE * from abc""") data = cur.fetchall() print (data) After inserting or deleting on table abc from another connection; i call the same query on python; but data is not updating. I add the query "SET SESSION query_cache_type = OFF;" before select query, but it didn't work. Someone said "select NOW() ..." query is not cachable but it didn't work again. What should I do? I

get raw decimal value from mysqldb query

假如想象 提交于 2019-11-27 15:02:57
I am executing a mysql query in python using the MySQLdb package. The code looks something like this: c=db.cursor() c.execute("""select * from table""") output = [] for row in c: output.append(row[4]) where row[4] contains a decimal value that I want to store in the output list. The problem is every value that I am getting looks like this: Decimal('XX.XX') where all I want in the output list is XX.XX. At the end of the script, my output list looks like this: [Decimal('10.02'), Decimal('20.24'), ...] But I need it to just contain the numbers, like this: [10.02, 20.24, ...] How do I do that?

Installing MySQLdb on Mac OS X

混江龙づ霸主 提交于 2019-11-27 15:01:06
问题 I've spent several hours trying to install MySQLdb (the Python library) on Mac OS X Snow Leopard. I'm using these instructions from SO. I keep getting an error, so I've tried using MacPorts (as one of the answers to that question advises), but I continue to get the same error. Can anybody help? import MySQLdb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in <module> File "build/bdist.macosx-10

error: Setup script exited with error: command 'gcc' failed with exit status 1

僤鯓⒐⒋嵵緔 提交于 2019-11-27 14:47:20
问题 I get the following error when I try to install MySQL-python-1.2.3 under Python 2.6 in Fedora 14. Fedora 14 comes with Python 2.7 by default and I am working in a project which runs in Python 2.6, So I am not in a position to update Python from 2.6 to 2.7. _mysql.c:35:23: fatal error: my_config.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 The complete error message is as below [root@localhost MySQL-python-1.2.2]# python setup.py build

Python mySQL - escaping quotes

一笑奈何 提交于 2019-11-27 13:54:35
问题 I have seen this question asked in various ways on this website, but none of them exactly addressed my issue. I have an sql statement with single quotes inside it, and am trying to use recommended practices before making database queries with it. So the statement is like val2="abc 'dostuff'" sql="INSERT INTO TABLE_A(COL_A,COL_B) VALUES(%s,'%s')" %(val1, val2) a_cursor.execute(sql) However, when I run this, I get.. ProgrammingError: (1064,"You have an error in your SQL syntax; check the manual