Can't get MySQLDb to work in python on Mac is there other easier DB?
Question: I am looking for a production database to use with python/django for web
development. I've installed MySQL successfully. I believe the python connector
is not working and I don't know how to make it work. Please point me in the
right direction. Thanks.

If I try importing `MySQLdb`:

    
    
    import MySQLdb
    

I get the following exception.

    
    
    Traceback (most recent call last):
      File "/Users/vantran/tutorial/scrape_yf/mysql.py", line 3, in <module>
        import MySQLdb
    ImportError: No module named MySQLdb
    

I've tried using MySQL but I am struggling with getting the connector package
to install or work properly.
<http://dev.mysql.com/downloads/file.php?id=414340>

I've also tried to look at the other SO questions regarding installing MySQL
python connectors, but they all seem to be unnecessarily complicated.

I've also tried

  1. <http://www.tutorialspoint.com/python/python_database_access.htm>
  2. <http://zetcode.com/db/mysqlpython/>
  3. <https://github.com/PyMySQL/PyMySQL>

...but nothing seems to work.


Answer: If your problem is with the `MySQLdb` module, not the MySQL server itself, you
might want to consider [`PyMySQL`](https://github.com/PyMySQL/PyMySQL)
instead. It's much simpler to set up. Of course it's also somewhat different.

The key difference is that it's a pure Python implementation of the MySQL
protocol, not a wrapper around `libmysql`. So it has minimal requirements, but
in a few use cases it may not be as performant. Also, since they're completely
different libraries, there are a few rare things that one supports but not the
other, and various things that they support differently. (For example,
`MySQLdb` handles all MySQL warnings as Python warnings; `PyMySQL` handles
them as information for you to process.)

