views:

137

answers:

2

Just installed Django (with easy_install) and created a project, but can't get mysql to work.

python manage.py syncdb throws this error:

.....
File "/Library/Python/2.6/site-packages/Django-1.1.1-py2.6.egg/django/db/backends/mysql/base.py", line 13, in <module>
        raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

I have MAMP installed and path to MySQL is probably: /Applications/MAMP/Library/bin/mysql

Thanks!

+2  A: 

you need Python library for MySQL access, MySQLdb:

http://sourceforge.net/projects/mysql-python/

GeeKieR
Oh, I need to install this although I have MySQL installed (forgive my technical virginity)? I just tried "easy_install -Z mysql_python" but it also give an error: "EnvironmentError: mysql_config not found"
Nimbuz
@Nimbuz: It seems mysql_config is a command line tool that is part of the MySQL client library. On Debian you'd have to install "libmysqlclient15-dev", but apparently you use Mac OS X, so I can't help you with that.
paprika
A: 

The MySQL egg requires a compiler from the dev tools (download XCode from the apple developers site) and a MySQL installation.

If you have installed those, you have set the PATH to include mysql_config.

export PATH=$PATH:/usr/local/mysql-5.1.39-osx10.5-x86_64/bin/

Check the path, as this is the installation on my machine!

After that, you should be able to build the egg with easy_install.

Also have a look at: Some blog about installing MySQL db on OS X

Good google terms are MySQLdb OS X Snow Leopard.

extraneon