I don't know which of these two steps have been the responsible of my success:
1) I updated my 'MySQL client libraries':
---1.1.- rpm -Uvh MySQL-shared-compat-4.1.13-0.i386.rpm
---1.2.- soft links to the new 'libmysqlclient_r.so.14.0.0' and 'libmysqlclient.so.14.0.0'
2) I made a soft link from '/usr/include/mysql' to '/usr/src/redhat/BUILD/mysql-4.1.9/include/', since the first one was empty and was the '--include' value of my 'mysq_config'.
Thank you very much for your tips!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Did you build MySQL-python-1.2.0 yourself? It is almost certainly trying to link against the wrong version of the MySQL client library (usually libmysqlclient_r.so). I suspect that your MySQLdb (and thus _mysql) is built against MySQL-4.1 libraries but you actually have 4.0 libraries installed, since mysql_rollback is a 4.1 and newer API call. However you do not give your MySQL version.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Version 10 of these libraries are for MySQL-3.23. I think you need to uninstall this version (probably the stock Red Hat version) and install your 4.1.9 build.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
MySQL-python-1.2.0
I'm trying to execute this script:
!/usr/bin/python
import MySQLdb
conn = MySQLdb.connect (host = "localhost", user = "root", passwd = "xxxx", db = "test")
cursor = conn.cursor ()
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
print "server version:", row0
cursor.close ()
conn.close ()
But I get this error message:
[ ]# python test.py
Traceback (most recent call last):
File "test.py", line 2, in ?
import MySQLdb
File "/usr/lib/python2.3/site-packages/MySQLdb/init.py", line 27, in ?
import _mysql
ImportError: /usr/lib/python2.3/site-packages/_mysql.so: undefined symbol: mysql_rollback
What am I doing wrong? Thank you very much.
Hi Andy.
Finally I've just solved the issue!!
I don't know which of these two steps have been the responsible of my success:
1) I updated my 'MySQL client libraries':
---1.1.- rpm -Uvh MySQL-shared-compat-4.1.13-0.i386.rpm
---1.2.- soft links to the new 'libmysqlclient_r.so.14.0.0' and 'libmysqlclient.so.14.0.0'
2) I made a soft link from '/usr/include/mysql' to '/usr/src/redhat/BUILD/mysql-4.1.9/include/', since the first one was empty and was the '--include' value of my 'mysq_config'.
Thank you very much for your tips!!
Did you build MySQL-python-1.2.0 yourself? It is almost certainly trying to link against the wrong version of the MySQL client library (usually libmysqlclient_r.so). I suspect that your MySQLdb (and thus _mysql) is built against MySQL-4.1 libraries but you actually have 4.0 libraries installed, since mysql_rollback is a 4.1 and newer API call. However you do not give your MySQL version.
Hi Andy. Thank you very much for answer my question.
This is the way I build MySQL-python:
[]# mysql_config
Usage: /usr/src/redhat/BUILD/mysql-4.1.9/scripts/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/include/mysql -g -pipe -m32 -march=i386 -mcpu=i686]
--include [-I/usr/include/mysql]
--libs [-L/usr/lib/mysql -lmysqlclient -lcrypt -lnsl -lm -lz]
--libs_r [-L/usr/lib/mysql -lmysqlclient_r -lpthread -lcrypt -lnsl -lm -lpthread -lz]
--socket [/var/lib/mysql/mysql.sock]
--port [3306]
--version [4.1.9]
--libmysqld-libs [-L/usr/lib/mysql -lmysqld -lpthread -lcrypt -lnsl -lm -lpthread -lrt -lcrypt -lnsl -lm -lz]
[]# export PATH=$PATH:/usr/src/redhat/BUILD/mysql-4.1.9/scripts/
[]# export mysqlclient=mysqlclient
[]# python setup.py clean
[]# python setup.py build
In addition:
[]# locate libmysqlclient
/usr/lib/mysql/libmysqlclient.so.10.0.0
/usr/lib/mysql/libmysqlclient.so.10
/usr/lib/mysql/libmysqlclient_r.so.10.0.0
/usr/lib/mysql/libmysqlclient_r.so.10
/usr/lib/mysql/libmysqlclient.so
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql_r/.libs/libmysqlclient_r.a
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql_r/.libs/libmysqlclient_r.lai
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql_r/.libs/libmysqlclient_r.la
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql_r/libmysqlclient_r.la
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql/.libs/libmysqlclient.a
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql/.libs/libmysqlclient.lai
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql/.libs/libmysqlclient.la
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql/libmysqlclient.la
/usr/src/redhat/BUILD/mysql-4.1.9/libmysql/mysql/libmysqlclient.a
Any suggestion is welcome. Regards.
This is your problem:
/usr/lib/mysql/libmysqlclient.so.10.0.0
/usr/lib/mysql/libmysqlclient.so.10
/usr/lib/mysql/libmysqlclient_r.so.10.0.0
/usr/lib/mysql/libmysqlclient_r.so.10
/usr/lib/mysql/libmysqlclient.so
Version 10 of these libraries are for MySQL-3.23. I think you need to uninstall this version (probably the stock Red Hat version) and install your 4.1.9 build.