MySQL Forums
Forum List  »  Connector/Python

How to Install MySQLdb on Solaris
Posted by: Jeff Clough
Date: March 28, 2007 11:20AM

Maybe I'm the only one having this trouble, but just in case, here's what I ended up having to do:

After extracting the tarball, change to that directory and run "python setup.py build" (as usual). This builds a _mysql.so file that can't find its mysqlclient library. So rebuild this file by hand. In my particular instance, setup.py used the command:

cc -G build/temp.solaris-2.9-sun4u-2.4/_mysql.o \
-L/usr/local/mysql/lib/mysql -lmysqlclient \
-lz -lposix4 -lgen -lsocket -lnsl -lm \
-o build/lib.solaris-2.9-sun4u-2.4/_mysql.so

So I added the -R option below:

cc -G build/temp.solaris-2.9-sun4u-2.4/_mysql.o \
-R/usr/local/mysql/lib/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient \
-lz -lposix4 -lgen -lsocket -lnsl -lm \
-o build/lib.solaris-2.9-sun4u-2.4/_mysql.so

The usual "python setup.py install" as root command does something completely funky with egg files. To install MySQLdb as an ordinary Python module, become root and do this

cd build/lib.solaris-2.9-sun4u-2.4
chown -R root:root *
chmod -R o+rX *
mv * /usr/local/lib/python2.4/site-packages

Of course, you'll have to adjust those paths to ones that fit your situation, but this leaves MySQLdb installed and ready to import into your Python scripts. If anyone has a better method, I'd love to hear about it. (And the egg thing. Why do we suddenly need egg files for this?)

Options: ReplyQuote


Subject
Written By
Posted
How to Install MySQLdb on Solaris
March 28, 2007 11:20AM


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.