Took me a days to get mysqldb working on Snow Leopard so this time round I did a completely clean install of the operating system and carefully followed the various instructions on installation to try and get my django development environment working.
brew install mysql
sudo pip intall django
sudo pip install python-mysql
ln -s sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
export PATH=/usr/local/mysql/bin:$PATH
sudo export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
Mysql and django working fine, but if I try to import MySQLdb or do a syncdb I get this error:
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Symbol not found: _mysql_affected_rows
Referenced from: /Library/Python/2.7/site-packages/_mysql.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_mysql.so
>>>
Have been googling for a day now with no success and really need to get back to work! Any suggestions very welcome.
(also tried to install the mysql python-connector here http://dev.mysql.com/downloads/connector/python/ but there is no osx version and other instructions seem to imply you need the right version for your version of python no platform so I didn't pursue that further.)