Installing MySQL Client tools, binaries, and library on Ubuntu Linux
NOTE: I am not going to explain how to install MySQL Database Server (DBMS System) in this tutorial. This tutorial only explains how to install the client libraries, so that other software (e.g. PHP) can use the libraries to access MySQL Server installed on some other computer. Also, note that I am going to compile and install the client, so please do not message me and tell me that this can be done using Ubuntu package manager. I already know that and also know the commands but I am only showing another method for installation to people like me who want to do everything themselves. This tutorial will also be of some benefit to people who like to try the latest releases.
Before starting, please check to see if there is a latest version available to download. Visit http://dev.mysql.com/downloads/mysql/5.0.html#source to find out about the latest available versions of MySQL version 5. IMPORTANT: See "Configuring Ubuntu Linux After Installation" to install the development tools required to compile and install MySQL Client from source code.Steps to download, compile, and install are as follows. Note: Replace 5.0.45 with your version number:
Before installing MySQL Client you have to install the development packages of libncurses and zlib, so let us do that by running the commands below.
apt-get install libncurses5-dev apt-get install zlib1g-dev
Run the command below,
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/ mysql-5.0.45.tar.gz/from/http://mysql.mirror.rafal.ca/
I downloaded the source file from a Canadian mirror. Please visit http://dev.mysql.com/downloads/mysql/5.0.html#source to find a mirror near you.
Also, download the MD5 hash to verify the integrity of the downloaded file.
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/ mysql-5.0.45.tar.gz.md5/from/http://mysql.mirror.rafal.ca/
Click here to find out how to check the integrity of downloaded files using MD5Sums. You can also get the MD5Sum signature (in red circle in the image below) from MySQL's website (recommended) on the downloads page.
Please note that if you are using MySQL client for a highly secure/critical setup (or for any other reason) then you should also check the PGP signatures (not covered in this tutorial for simplicity).
Extracting files from the downloaded package:
tar -xvzf mysql-5.0.45.tar.gzNow, enter the directory where the package is extracted.
Click here to find out how to install zlib before configuring and installing MySQL client libraries and tools.
Configuring MySQL source code:
./configure --without-server --enable-thread-safe-client --with-client-ldflags=-all-static --prefix=/usr/local/mysql --with-machine-type=powerpc --with-zlib-dir=/usr/local/zlib --without-debug --without-docs --with-big-tablesReplace "/usr/local/mysql" with the path where you want to install MySQL libraries and also replace "/usr/local/zlib" with your zlib directory. You also have to replace "powerpc" with your architecture type. Note: check for any error message.
Compiling MySQL source code:
Note: check for any error message.
Installing MySQL source code:
As root (for privileges on destination directory), run the following.With sudo,
sudo make installWithout sudo,
Note: check for any error messages.
More Configuration (setting PATH variable and library path):
sudo echo '/usr/local/mysql/lib/' >> /etc/ld.so.conf sudo ldconfig
Also, run the following.
Replace "/usr/local/mysql" with your installation directory. If you are running the BASH shell then do the following to make changes to PATH variable permanent.
echo "PATH=$PATH:/usr/local/mysql/bin" >> ~/.bash_profile
Testing the installation:
Run the command below
mysql -h192.168.5.15 -utest -p
Replace "192.168.5.15" with your MySQL server host name and "test" with your user name (user name on MySQL database server). You'll be prompted for a password. Enter the password. If the password is entered correctly you should see MySQL client console (see the image below).
That’s it. MySQL Client tools, binaries, and library have been successfully installed.
Please feel free to use the comments form below if you have any questions or need more explanation on anything. Use the icons below to share this tutorial with your friends.