Since the version of MySQLDB was changing in the old days, the instructions about how to install this useful tool varies a lot, which makes this tool is very hard to install.
Among all these instructions I found, I find they are not for the current version of MySQLDB. And some steps mentioned by these instructions are not necessary.
So I'm just going to give my install procedure. Hope it will help someone.
The MySQLDB I'm using is the MySQL-python-1.2.4b4.
Make sure you have install gcc, mysql-devel and of cource mysql. If not, follow this post.
Although most EC2 instance will be with python, but still you will need python-devel.
yum install python-devel
Note that this may need admin user.
Download the source code to some place you can easily access to, and unzip it:
url -O http://jaist.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz tar -xzvf MySQL-python-1.2.4b4.tar.gz
Go into the dir you just unzipped, install it directly:
python setup.py build python setup.py install
It should be done by now. You could check by
in the python console.
The procedure could be a little different according how you set up your EC2 instance, but the most tricky part, I believe, is installing python-devel before you install the MySQLdb.
To sum up, before you install MySQLdb, make sure you have below all intalled:
- Mysql(if you are using the local instance of mysql)