5

Running my server (python manage.py runserver) yielded this error:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

I attempted the winning solution on this page with no avail: Django + MySQL on Mac OS 10.6.2 Snow Leopard

And then moved on to try Thierry Lam (5 votes) on Django - MySQLdb: Symbol not found: _mysql_affected_rows

After Thierry Lam's suggestions, my error now reads:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/steven/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.3-fat.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib

Which seems very much like the same linking issue. Any wisdom to share? Thanks in advance.

Community
  • 1
  • 1

2 Answers2

15

It looks like you have everything installed right, but it can't find libmysqlclient. Have you tried the following?

> sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
> sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
Jeff Holland
  • 276
  • 2
  • 4
  • Your first line solved my problem - what exactly does this do? Thanks so much for the help. – Steve Trevathan Jun 20 '11 at 19:08
  • 2
    You are creating a symbolic link. Your python-mysql module expects it to be in a different place than where it was installed. Now when it looks for the library the symbolic link points it to the correct location. – Jeff Holland Jun 21 '11 at 12:40
  • Worked for me too! Thanks. However, if I wanted to remove the symbolic link how would i do this? What exactly does a symbolic link do? – locoboy Oct 28 '11 at 16:45
1

Sounds like your just missing the mysql-python dependancy for mysql and Django. Don't know how you installed Django though. Use pip or easy_install to install it.

pip install mysql-python

For Django it is recommended to use PostgreSQL though, for development purposes setting up a sqlite database is much, much easier.

fijter
  • 17,607
  • 2
  • 25
  • 28