Tuesday, October 13, 2009

How to install MySQL-python-1.2.2

Installation process for MySQLdb modules on MAC OS X
Compatible python and mysql vertions are python 2.5 ,mysql 5.1.30

1. Download the latest MySQL for python adapter from source forge.

2. $tar xzvf MySQL-python-1.2.2.tar.gz

3. Go to the path of MySQL-python-1.2.2 and type this command $ sudo python setup.py clean

4. In MySQL-python-1.2.2 folder , edit the file "_mysql.c"

4a. Remove the following
#ifdef unit
#define unit unsigned int
#endif

4b. change the following
uint port=MySQL-port;
uint client_flag=0;
to
unsigned int port=MySQL_Port;
unsigned int client_flag=0;

5. Create a symbolic link under lib to point to a sub-directory called mysql
$sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

6. Edit the file setup_posix.py
mysql_config.path="mysql_config"
to
mysql_config.path="/usr/local/mysql/bin/mysql_config"

7. $sudo python setup.py build

8. $sudo python setup.py install

Note: If you get a 'gcc' error then try to get gcc package from Apple and install 'X-code' and all related gcc contents.
Now type $ sudo python setup.py clean
$ sudo python setup.py build
$ sudo python setup.py install
then restart your system.

9. Check this one in your python IDLE
>>>import MySQLdb
>>>

Good Luck .....

Saturday, October 10, 2009

To get a basic knowledge on Python.



Python Tutorial


First of all download Python 2.5.4 and IDLE 1.2.4 then now started your first python program with the help of the tutorial which is available by the above link.
Now we are learning only simple python programs or scripts. We don't want to consider any Database Applications. Once we get a basic knowledge on this one then we will move to Database application development part.