MySQL is an excellent, very popular and open source database management system. A binary installation is available for Mac OS, and the process of installing MySQL on Mac OS is also very well documented. So just head over to MySQL.com, where you will find the binary installation, together with extensive installation, and usage documentation.
To connect to MySQL from Python use MySQL for Python (MySQLdb). Get MySQLdb from http://sourceforge.net/projects/mysql-python/.
A binary installation is available for Mac OS, and the process of installing MySQL on Mac OS is also very well documented. So just head over to MySQL.com, where you will find the binary installation, together with extensive installation, and usage documentation. To connect to MySQL from Python use MySQL for Python (MySQLdb). Which for unknown reasons seems to be a pain in the backside if you’re on a Mac. I just wanted to be like the cool kids and try Django Ok enough of the nonsense. This is intended to help you if you’re having trouble getting MySQL-python installed or don’t know what to do when you get the message “No module named MySQLdb”.
- Download MySQL from mysql.com and install the DBMS as instructed in the documentation.
- Make sure “Library/Python/2.3” does not have:
- Directory “MySQL”
- File “_mysql.pyd”
- File “_mysql_exceptions.py”
- File “_mysql_exceptions.pyc”
Download Mysqldb For Mac
Either uninstall MySQL for Python if a setup program was used to install it, otherwise manually delete them.
Mysql Db For Mac
- Download and unpack MySQL for Python. At the time of writing this is MySQL-python-1.2.1_p2.tar.gz .
- Open Terminal and change to the directory where MySQLdb was unpacked to.
- Get rid of any previous builds that might interfere, by deleting the “build” directory if it exists.
- Edit the setup.py file, and change:return popen(“mysql_config –%s” % what)
to
return popen(“/usr/local/mysql/bin/mysql_config –%s” % what) - Cleanup any previous install attempts:python setup.py clean
- Build MySQLdb:python setup.py build
Mysqldb For Mac Os
Viola! MySQL for Python is all setup, and ready for your Python-MySQL data access code. Enjoy!