1

I am having problems getting python/django to connect to a MySQL database. The error message is basically "Error Loading MySQLDb module: No module named MySQLDb".

This is a fresh install right off python.org, so I assumed that it would have the MySQLDb module included, but it does not seem to. I also can't seem to find the module or how to install it, except in some sleazy looking parts of the net.

Is there a central point for getting this module? Why isn't it in the standard install? Can someone point me to a tutorial or some such to get this module installed?

Newbie in python, MySQL and Django.

Thanks for help.

3
  • 1
    What OS are we talking about? You need to install MySQL and MySQL python driver separately. Commented Aug 8, 2010 at 0:26
  • 1
    I don't know why you think it should have MySQLdb installed. It's not part of the standard library, and never will be. Commented Aug 8, 2010 at 8:50
  • Why is this question still without an unaccepted answer? Commented Aug 14, 2010 at 1:56

2 Answers 2

2

I believe http://pypi.python.org/pypi/MySQL-python/ is the Python module you need. In general, when looking for Python modules, http://pypi.python.org/ is where you should start (people will refer to it as either PyPI or "the cheese shop." If setuptools is installed (it may be already) then you can run easy_install MySQL-python.

As far as MySQL is concerned, you'll need to install that separately from a likely-looking package on http://dev.mysql.com/downloads/mysql/.

Sign up to request clarification or add additional context in comments.

Comments

0

this is how i handled the issue on Fedora13:

you can get the module here: http://sourceforge.net/projects/mysql-python/

download to a convenient directory

read the README file

build the module, according to the instructions in the README, keeping in mind to use the version of python you are planning to use as an interpreter (2.6 for me). if there are more than one version of python, simply using 'python' will probably alias you into a particular version, which might not be the one you want.

after the build is complete, the .egg file will have been created and landed in a 'site-packages' directory associated with the version of python which was used for the build.

then, ensure that the .egg file created (you can see the install path in the output from the install) is placed on your PYTHONPATH

that did it for me, anyhoo...

good luck! JR

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.