(ubuntu10.04) MySQL-python-1.2.3

Reference:net
1.mysql : sudo apt-get install mysql-server
2.other :
sudo apt-get install python-dev
sudo apt-get install libmysqld-dev
sudo apt-get install libmysqlclient-dev
3.MySQL-python-1.2.3.tar.gz
4.setup mysql-python:
shell>wget http://peak.telecommunity.com/dist/ez_setup.py
shell>sudo python ez_setup.py
shell>tar zxvf MySQL-python-1.2.3.tar.gz (Note:PATH)
shell>cd MySQL-python-1.2.3
shell>gedit setup_posix.py

mysql_config.path = “mysql_config” CHANGE TO (whereis mysql_config) LIKE
mysql_config.path = “/usr/bin/mysql_config”

shell>sudo python setup.py build
shell>sudo python setup.py install
DONE
5.TEST
tracylling@ubuntu:~/MySQL-python-1.2.3$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import MySQLdb
/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3-py2.6-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3-py2.6-linux-i686.egg/_mysql.pyc, but /home/tracylling/MySQL-python-1.2.3 is being added to sys.path
>>>cxn = MySQLdb.connect(user=’root’,passwd=’***’)

Leave a Reply

Your email address will not be published. Required fields are marked *