Install 32-bit MySQL client library on a 64-bit CentOS
How do I install 32-bit libmysqlclient.so?
1. Installation
Your MySQL installation could have come from different sources. It could be an rpm that came with the distribution or a Sun/Oracle rpm or it could have been built from sources.
rpm -q --whatprovides $(which mysql)
should tell you the name of the package like
MySQL-client-...
-
mysql-5.0...
-
mysql-community-server-client
mysql-5.1...
-
no package provides /usr/bin/mysql
.
On CentOS the first two options are most likely. MySQL-client-5.0
is a Sun/Oracle RPM and mysql-5.0
could have come from the distribution. Use rpm -q --info <package_name>
to get extended information and verify that the Vendor:
line confirms the hypothesis.
Here is a typical Vendor line:
Name : MySQL-shared-community Relocations: (not relocatable)
Version : 5.0.96 Vendor: Oracle and/or its affiliates
1.1 MySQL from Sun/Oracle RPMs
If your mysql installation comes from Sun/Oracle, go to MySQL Community server download page, select among Generally Available (GA) releases the one that has mysql 5.0 version and 32-bit architecture, choose MySQL-shared-community package, download and install it with rpm -i
. This package provides exactly the /usr/lib/libmysqlclient.so.15
library.
1.2 mysql from CentOS
In CentOS5 libmysqlclient belongs to the mysql package.
yum install mysql.i386
should do the trick.
In CentOS6 it was moved to a separate mysql-libs package.
2. Testing
After installing the library, check if dynamic library dependencies are resolved correctly:
ldd <your_binary> | grep libmysqlclient
should return something like
libmysqlclient.so.15 => /usr/lib/mysql/libmysqlclient.so.15
If you want to know what provides a 32-bit version of a specific 64-bit library, you could use rpm -q --whatprovides /path/to/your/lib64/library
to determine the name of the package. Then replace x86_64 with i686 in the name to get the name of the 32-bit counterpart. Use yum search
to verify if the package is provided by the repositories you have subscribed to.
Related videos on Youtube
Seva Alekseyev
I write code since 1993. Platform agnostic. Mainly C dialects. My grey cat is the best.
Updated on September 18, 2022Comments
-
Seva Alekseyev over 1 year
I'm trying to run a compiled 32-bit binary on a 64-bit CentOS 5.3 (based on RedHat 4.1.2) host. The binary complains about inability to find libmysqlclient.so.15. Such a file exists on the server, but it's 64-bit and therefore not good.
Can I install the 32-bit MySQL client libraries on the host? Preferably in the official way (i. e. via a repository). If not, what about a hackish way?
Also, is this a proper venue for such a question?
EDIT: here's an article that confirms that you cannot mix and match bitness within one process. But its recipe is not applicable to CentOS.
Wikipedia states that RHEL, which CentOS derives from, is capable of having a full 32-bit userland running along 64-bit... There are already some 32-bit libraries on the system -
libc
and such. Just not MySQL.I can run other 32-bit binaries that don't link to libmysqlclient.
EDIT:
yum search mysql
says the following:Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.symnds.com * extras: mirror.symnds.com * updates: mirror.wiredtree.com addons | 1.9 kB 00:00 base | 1.1 kB 00:00 extras | 1.9 kB 00:00 updates | 1.9 kB 00:00 Excluding Packages in global exclude list Finished ================================ Matched: mysql ================================ mod_auth_mysql.x86_64 : Basic authentication for the Apache web server using a : MySQL database. qt-MySQL.x86_64 : MySQL drivers for Qt's SQL classes. MySQL-bench.x86_64 : MySQL - Benchmarks and test system MySQL-client.x86_64 : MySQL - Client MySQL-devel.x86_64 : MySQL - Development header files and libraries MySQL-python.x86_64 : An interface to MySQL MySQL-server.x86_64 : MySQL: a very fast and reliable SQL database server MySQL-shared.x86_64 : MySQL - Shared libraries apr-util-mysql.x86_64 : APR utility library MySQL DBD driver bytefx-data-mysql.x86_64 : MySQL database connectivity for Mono freeradius-mysql.x86_64 : MySQL bindings for freeradius freeradius2-mysql.x86_64 : MySQL support for freeradius libdbi-dbd-mysql.x86_64 : MySQL plugin for libdbi pdns-backend-mysql.x86_64 : MySQL backend for pdns pure-ftpd.x86_64 : Lightweight, fast and secure FTP server qt4-mysql.x86_64 : MySQL drivers for Qt's SQL classes rsyslog.x86_64 : Enhanced system logging and kernel message trapping daemon rsyslog-mysql.x86_64 : MySQL support for rsyslog unixODBC.i386 : A complete ODBC driver manager for Linux unixODBC.x86_64 : A complete ODBC driver manager for Linux unixODBC64.x86_64 : A complete ODBC driver manager for Linux
-
MDMarra almost 12 yearsAnd why aren't you able to use the 64-bit client?
-
Seva Alekseyev almost 12 yearsCan you really use 64-bit libraries in 32-bit executables? Thought not. How are they going to agree on pointer size?
-
rackandboneman almost 12 yearsHOW it is done is indeed implementation dependent and I am not from the RH world, but it is definitely possible. In the (unlikely) worst case some things will have to be manually installed, or the binary will need to run in a 32 bit chroot.
-
-
Seva Alekseyev almost 12 yearsI noticed that. Libmysqlclient is not among them. How do I install 32-bit libmysqlclient.so, please?
-
Seva Alekseyev over 11 yearsSays
No package mysql-libs.i686 available.
-
Seva Alekseyev over 11 yearsNeither mysql-libs.i386 nor mysql.i386 is available, either.
-
Seva Alekseyev over 11 yearsEdited the question. There's only one i386 package there, and it's unixODBC.i386.
-
Zachw6 over 11 years@SevaAlekseyev My quess is that mysql was installed on the machine from Sun/Oracle rpms instead of the CentOS ones and CentOS rpms are on the exlcude list. You could check which version of x86_64 rpms is installed with
rpm -q MySQL-client
and get a corresponding i386 rpm from MySQL Community server dowlnoads