Installing MySQLdb on Mac OS X 10.9.5
Question: From this [link](https://pypi.python.org/pypi/MySQL-python/1.2.4) I downloaded
MySQLdb and run following two commands

    
    
    sudo python setup.py build
    sudo python setup.py install
    

I also define the environment path in .bash_profile as follows

    
    
    export PATH="/Applications/XAMPP/xamppfiles/bin/:$PATH"
    

The **problem** is after running above command I don't see any error, but when
I try the following command in python shell I see error

    
    
    import MySQLdb
    

**Error Log:**

    
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "MySQLdb/__init__.py", line 19, in <module>
        import _mysql
    ImportError: dlopen(//anaconda/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.5-x86_64.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
      Referenced from: //anaconda/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.5-x86_64.egg/_mysql.so
      Reason: image not found
    

My Operating system - Mac 10.9.5 and Python version - 2.7.5 :: Anaconda 1.6.1
(x86_64)

**How I can install MySQLdb on Mac OS X 10.9.5, 64bit?** Thanks.

Duplicate with [this
question](http://stackoverflow.com/questions/5531958/installing-mysqldb-on-
mac-os-x), but this is for 32bit Mac OS X Snow Leopard.


Answer: Since Mysql has officially supply the driver for python called mysql
connector, And Mysqldb has not been in maintenance, I suggest you install the
offical one and Django has supported it,
<http://dev.mysql.com/downloads/connector/python/>, Then in your settings.py:
Just Change the engine name

    
    
        DATABASES = {
        'default': {
            'NAME': 'user_data',
            'ENGINE': 'mysql.connector.django',
            'USER': 'mysql_user',
            'PASSWORD': 'priv4te',
            'OPTIONS': {
              'autocommit': True,
            },
        } 
    }
    

And the guide for developer <http://dev.mysql.com/doc/connector-
python/en/index.html>

Have fun

