It took me 4 days looking how to install this Mysqldb to no avail. i found a lot of sulutions no one is working with me
I tried to build it from the source with many ways to no avail. My environment is Windows XP. MySQL 5.0. Python 2.6 (windows version).
Yesterday i received an email from a friend about another mysql connector named "pymysql" it's very easy to install it in three steps:
Step1:
Install Python setuptools (easy_install.exe) if you haven’t installed it. It is required to install pymysql.
To install setuptools
Download these two files and put them into the same directory:
- http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg#md5=ca37b1ff16fa2ede6e19383e7b59245a
- http://peak.telecommunity.com/dist/ez_setup.py
Add the path where easy_install is installed into your environment PATH ({PYTHON_PATH}\Scripts, {PYTHON_PATH} is the path where python is installed).
Step2:
Install pymysql, it's easy just donwload the latest version of PyMySQL-0.3-py2.6.egg, put it in a directory and open a command prompt, change to this directory. then run "easy_install.exe PyMySQL-0.3-py2.6.egg" if it doesn't work try an absolute path of easy-install ({PYTHON_PATH}\Scripts\easy_install.exe PyMySQL-0.3-py2.6.egg)
Step3:
Now you can test it in python just open the "IDLE(Python GUI)" and run the test below:
>>>import pymysql
>>>conn = pymysql.connect(host='localhost', port=3306, user='root', passwd=None, db='mysql') >>>cur = conn.cursor() >>>cur.execute("SELECT Host,User FROM user") >>>for r in cur: >>> print r
>>>cur.close() >>>conn.close()
Step 4 for django: To use it with django you need one more step:go to the django directory, exactly in this directory{..\PythonPath}\Lib\site-packages\django\db\backends\mysql
and simply do a search and replace of MySQLdb with pymysql
in the two files "base.py" and "introspection.py"
That's it.
thanks to mouad for the link and to