Menu

Problem when upgrading MySQL

Help
2006-04-24
2012-09-19
  • Mr Teaspoon

    Mr Teaspoon - 2006-04-24

    Hi,

    I am running Fedora Core 2. Previously, I had MySQLdb 1.2.1_p2 running fine with MySQL 3.23.58. However, I recently decided to update to MySQL 4.1.18 (from RPMs). Having done so, I verified which libraries were available:

    /usr/lib/mysql/libmysqlclient_r.la
    /usr/lib/mysql/libmysqlclient.la
    /usr/lib/mysql/libmysqlclient_r.a
    /usr/lib/mysql/libmysqlclient.a
    /usr/lib/libmysqlclient_r.so
    /usr/lib/libmysqlclient.so.14
    /usr/lib/libmysqlclient.so.14.0.0
    /usr/lib/libmysqlclient_r.so.14
    /usr/lib/libmysqlclient.so
    /usr/lib/libmysqlclient_r.so.14.0.0

    I then ran

    python setup.py build

    and this was successful. The problem is that when I examine the shared library dependencies of _mysql.so, I get the following:

    ldd build/lib.linux-i686-2.4/_mysql.so

        libmysqlclient.so.10 => not found
        libz.so.1 => /usr/lib/libz.so.1 (0x00c4d000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x0015f000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00cd9000)
        libm.so.6 => /lib/tls/libm.so.6 (0x00ec3000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00c70000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00755000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00a46000)
    

    Naturally, on trying to import MySQLdb, I get an ImportError.

    My apologies if this is addressed elsewhere but I can't find anything in the README or otherwise that would explain why when I build, the old MySQL library is still referenced, given that I have done a seemingly clean update. I have tried building both static and non but both lead to the same result. I have also checked that the mysql_config command displays information relating to the new MySQL version.

    Have I missed something really obvious?

    Many thanks.

     
    • Mr Teaspoon

      Mr Teaspoon - 2006-04-25

      Bingo.

      I had run setup.py clean but foolishly didn't actually remove the build directory. Removing it manually and rebuilding does the trick.

      So the answer to my question, "Have I missed something really obvious?" is "Yes"! Too many late nights...

      Thank you, Andy.

       
    • Andy Dustman

      Andy Dustman - 2006-04-24

      You have multiple versions of MySQL installed, and MySQLdb links against one when compiling but can't find this library when running/importing. Here are some library .so version numbers and versions of MySQL they correspond to:

      10 -- 3.23
      12 -- 4.0
      14 -- 4.1
      15 -- 5.0

      You're building against 3.23 but also have 4.1 installed. Run mysql_config and see what happens. Chances are your 3.23 installation is not completely removed.

       
    • Mr Teaspoon

      Mr Teaspoon - 2006-04-24

      If I run mysql_config, I get the following:

      --cflags [-I/usr/include/mysql -g -pipe -march=i386 -mcpu=i686]
      --include [-I/usr/include/mysql]
      --libs [-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm]
      --libs_r [-L/usr/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread]
      --socket [/var/lib/mysql/mysql.sock]
      --port [3306]
      --version [4.1.18]
      --libmysqld-libs [-L/usr/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]

      If I run rpm -qa | grep -i MySQL, I get this:

      MySQL-server-4.1.18-0.glibc23
      MySQL-devel-4.1.18-0.glibc23
      MySQL-shared-4.1.18-0.glibc23
      MySQL-client-4.1.18-0.glibc23

      Is there any other way to tell if any other bits of 3.23 are lying around? In particular, which files might lead MySQLdb to link against the old version when compiling?

      Thanks again.

       
      • Andy Dustman

        Andy Dustman - 2006-04-25

        Get rid of your build directory and rebuild, and post the output here if it does not work. It's not clear that you actually rebuilt against the new libraries anyway, re-reading your first post. Just doing setup.py build does not necessarily rebuild _mysql.so, since distutils uses timestamps to determine if something should be rebuilt, and upgrading MySQL would not affect the timestamps.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.