If you see this, you are probably mistaken when installing MySQLdb; re-read (or read) README. _mysql is a low-level C module that interacts with the MySQL client library.
Various versions of MySQLdb in the past have had problems building on "weird" platforms; “strange” in this case means “not Linux”, although usually on Unix / POSIX platforms, including BSD and Mac OS X, there are no problems. Windows was more problematic, in part because there was no mysql_config MySQL in the Windows installation. 1.2.1 solves most, if not all, of these problems, but you still have to edit the configuration file so that the configuration knows where to find MySQL and which libraries to include.
ImportError: libmysqlclient_r.so.14: cannot open shared object file: No such file or directory
The number after .so may change, but this means that you have a version of MySQLdb compiled with one version of MySQL and are now trying to run it against another version. The shared library version tends to change between major releases.
Solution: restored MySQLdb or get the appropriate version of MySQL.
Another thing that can cause this: MySQL libraries may not be in your system path.
Solutions:
set the LD_LIBRARY_PATH environment variable so that it includes the path to the MySQL libraries. set static=True in site.cfg for static linking reconfigure your system so that the MySQL libraries are on the default loader path. In Linux, you edit /etc/ld.so.conf and run ldconfig. For Solaris, see Linker and Libraries Guide. ImportError: ld.so.1: python: fatal: libmtmalloc.so.1: DF_1_NOOPEN tagged object may not be dlopen()'ed
This is strange from Solaris. What does it mean? I have no idea. However, such things can happen if there is some inconsistency in the compiler or environment between Python and MySQL. For example, on some commercial systems you may have some code compiled with your own compiler, and other things compiled with GCC. They do not always connect together. One way to deal with this is to get binary packages from different vendors.
Decision. Reinstall Python or MySQL (or possibly both) from the source.
ImportError: dlopen(./_mysql.so, 2): Symbol not found: _sprintf$LDBLStub Referenced from: ./_mysql.so Expected in: dynamic lookup
This is one of Mac OS X. This seems to be a compiler mismatch, but this time between two different versions of GCC. It seems that almost every major release of GCC changes ABI in some cases, therefore, for example, linking code compiled with GCC-3.3 and GCC-4.0 can be problematic.