MySQL Forums
Forum List  »  Connector/Python

Re: Help,A Problem of MySQL-python
Posted by: r r
Date: August 02, 2006 09:53AM

hey guys, after smashing my head against this problem for a day, I got it working. not sure if will help anybody else, but this is what I had and how it worked:

first, I was running on a machine with no python sources and no mysql devel installed. so, let's get those.
1. python sources from python
2. mysql sources from mysql (mysql5)
3. MySQL-shared-standard-5.0.22-0.rhel4.i386.rpm (for the .so shared libraries)

second, unpack and configure.
1. python, just unpack in a /usr/src/redhat/SOURCES/Python2.3 folder
1.1. create a link from /usr/include/python2.3 towards the /usr/src/redhat/SOURCES/Python-2.3.4/Include/

2. mysql sources unpacked in the /root/downloads/mysql5 (please don't tell me to run as non root).
2.1. run the ./configure, which will create a config.h. copy that as my_config.h in the include subdirectory (will be needed by the python driver).

3. just rpm -i the MySQL-shared-standard-5.0.22-0.rhel4.i386.rpm. this will put in the /usr/lib the libmysqlclient libs.
3.1. run a ldconfig so the cache gets updated.

third. now we get to the actual driver installation.
1. get the MySQLdb thingy, unpack it somewhere.
2. edit the site.cfg so they point to the correct libs and headers
example:
....
[compiler]
#mysql_root: /usr/local/mysql
library_dirs: /usr/lib
include_dirs: /root/downloads/mysql-5.0.22/include
# libraries: mysqlclient
....

3. do the "python setup.py build", make sure you have no error and a _mysql.so gets build in the build/lib.linux-i686-2.3 subfolder.
4. get back to the initial folder and do the "python setup.py install" (as root). it should install it in the /usr/lib/python2.3/site-packages.
5. test your installation "python test_MySQLdb_capabilities.py", make sure that you have a correct username and password in those tests.

hope it works...
ranjix

Options: ReplyQuote


Subject
Written By
Posted
Re: Help,A Problem of MySQL-python
r r
August 02, 2006 09:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.