Download, configure, compile, and install MySQL 5.5 from source code on Linux
MySQL 5.5 is the latest production-ready release of the most popular opensource database management system on the planet ie. MySQL.
In this tutorial, I am going to tell you how to download, configure, compile, and install MySQL 5.5 from source code on a Linux machine. You can read my tutorial "Install MySQL Server 5.0 and 5.1 from source code" for previous versions of MySQL server. Also, you can find instructions on how to download and install MySQL 5.6 here. Please prepare yourself to install several libraries on the server before installing MySQL 5.5. Luckily, I have already written about those libraries in my previous tutorials.
Please make sure you check the downloaded file's integrity before unzipping it. '#' (w/o quotes) in front of commands below means you have to run the commands as root user (or use sudo
Here are the libraries and softwares you need to install alongwith their installation tutorials (some tutorials are outdated ie. they are for older versions of libraries, so try finding the latest stable releases for all software systems and libraries before installing). In any case, you should try using properly tested binaries that come with your OS distribution (recommended for production):
- How to download, compile, and install GNU ncurses on Debian/Ubuntu Linux
- How to download and install Bison (GNU Parser Generator)
- How to download, compile, and install CMake on Linux
- Installing libaio on Linux
Installing libaio on Linux:
InnoDB Plugin 1.1 (default in MySQL 5.5) now uses asynchronous I/O on Linux systems. This change introduces a dependency on libaio.
$ cd /opt $ wget http://www.morphisms.net/~wkj/download/libaio.tbz $ bunzip2 libaio.tbz $ tar xf libaio.tar
After installing all these software, let's begin with the actual server installation process.
Download and extract MySQL 5.5.8:
Please make sure you check file's integrity after downloading (before installing).
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.8.tar.gz/from/http://mysql.llarian.net/ $ tar xzf mysql-5.5.8.tar.gz $ cd mysql-5.5.8
Configure and compile MySQL 5.5.8:
Please make sure you replace path locations according to your environment in commands below (if you are following my earlier tutorials for installation of required libraries then it is quite possible that you installed them under /usr/local/, if so please adjust the path in command below):
$ PATH=$PATH:/opt/bison/bin #bison binary should be in your path $ /opt/cmake/bin/cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/opt/mysql-5.5.8/data/ \ -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.8 -DCURSES_LIBRARY=/opt/ncurses/lib/libncurses.a \ -DCURSES_INCLUDE_PATH=/opt/ncurses/include/ -DHAVE_LIBAIO_H=/opt/libaio/include/ \ -DINSTALL_LAYOUT=STANDALONE -DENABLED_PROFILING=ON \ -DMYSQL_MAINTAINER_MODE=OFF -DWITH_DEBUG=OFF \ -DDEFAULT_CHARSET=utf8 -DENABLED_LOCAL_INFILE=TRUE -DWITH_ZLIB=bundled $ make
Install MySQL 5.5.8:
# make install
You can initialize the server you just installed by using the instructions explained in Initializing MySQL database after installation.
Did this tutorial help a little? How about buy me a cup of coffee?
Please feel free to use the comments form below if you have any questions or need more explanation on anything. I recommend thoroughy testing on a production-like test system first before moving to production.