[DB-SIG] Problems with MySQL

Paul DuBois paul@dubois.ws
Thu, 21 Dec 2000 14:52:34 -0600

At 5:17 PM -0800 12/20/00, Ryan Weisenberger wrote:
>I'm trying to install and use the MySQL module written by Andy 
>Dustman.  I'm using version 0.3.0, with Python 2.0 and MySQL 3.23 on 
>Redhat Linux 6.2.  It compiles fine, but when I try:
>db1 = MySQLdb.Connect(db='test')
>I get a SIGSEGV and a core dump.
>Running it under gdb, I can trace it down to _mysqlmodule.c:
>conn = mysql_real_connect(&(c->connection), host, user, passwd, db,
>                       port, unix_socket, client_flag);
>All the values look good going in, but that's where it explodes.
>Has anyone encountered this or have any solutions?

What's your *exact* MySQL server version?  I just updated to MySQL
3.23.29a-gamma, and found that the "a" caused MySQLdb 0.3.0 to cough
at the code that splits the three numeric hunks out of the version string.
(Normally versions are n.nn.nn-xxxx, where n is a digit.)

I find that this fixes the problem (split on dots, strip non-digit
stuff from third component):

--- MySQLdb.py.orig	Tue Oct 31 13:51:19 2000
+++ MySQLdb.py	Thu Dec 21 14:47:23 2000
@@ -454,7 +454,9 @@
          self.db = apply(connect, (), kwargs)
          self.quote_conv[types.StringType] = self.Thing2Literal
          self._server_info = self.db.get_server_info()
-        i = map(int, split(split(self._server_info, '-')[0],'.'))
+        i = split(self._server_info,'.')
+        i[2] = re.sub('\D*$','',i[2])
+        i = map(int, i);
          self._server_version = i[0]*10000 + i[1]*100 + i[2]
          if _threading: self.__lock = _threading.Lock()

However, my scripts weren't core dumping, they just exited with
a stack trace, so this may not be your problem.  I too am running
MySQLdb 0.3.0 and RedHat 6.2, but I'm still running Python 1.5.1.