Install MySQL Server 5.0 and 5.1 from source code
Have you ever tried to download and install MySQL server 5.0 or 5.1 from source code? If you have not but want to, here are the easy steps to do so on a Debian/Ubuntu Linux machine. These instructions should work on other Linux distributions e.g. SUSE, RedHat, CentOS etc. Firstly, you will need to install libncurses. Luckily, I have already written about how to install libncurses here. Next, you need to decide what MySQL version you wish to install.
In this tutorial, I have only explained the installation instructions for MySQL 5.0 and 5.1. The specific version of MySQL database server that I chose are 5.0.91 and 5.1.51. These instructions were tested on Debian Lenny. Please make sure you check the downloaded file's integrity before unzipping it (click here for more info on this). '#' (w/o quotes) in front of the commands below means you have to run the command as root user (or use sudo
You have to download MySQL source code tarred and gzipped files from MySQL's website first. For MySQL version 5.0 and lower, you have to go to the Archives page on MySQL's website. You can download the files for mysql 5.0.91 from http://downloads.mysql.com/archives.php?p=mysql-5.0&v=5.0.91. You can change the installation directory in ./configure commands below by changing the value assigned to prefix option.
How to install MySQL 5.5 from source code on Linux:
This topic was pretty long, so I wrote a separate tutorial "Download, configure, compile, and install MySQL 5.5.8 from source code on Linux".
How to download and configure MySQL 5.1 for installation:
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz/from/http://mysql.he.net/ $ tar xzf mysql-5.1.51.tar.gz $ cd mysql-5.1.51 $ ./configure --enable-profiling --prefix=/opt/mysql-5.1.51/ --enable-local-infile \ --with-mysqld-user=mysql --with-big-tables \ --with-plugins=partition,blackhole,federated,heap,innodb_plugin --without-docs \ --with-named-curses-libs=/opt/ncurses/lib/libncurses.a #replace the ncurses location a/c to your system
How to download and configure MySQL 5.0 for installation:
$ wget http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.91.tar.gz $ tar xzf mysql-5.0.91.tar.gz $ cd mysql-5.0.91 $ ./configure --enable-community-features --prefix=/opt/mysql-5.0.91/ --enable-local-infile \ --with-mysqld-user=mysql --with-big-tables --with-plugins=partition,blackhole,federated,heap,innodb_plugin \ --without-docs \ --with-named-curses-libs=/opt/ncurses/lib/libncurses.a #replace the ncurses location a/c to your system
Install MySQL 5.0 and 5.1:
Now, after configuring the MySQL server you just have to compile and install it on your machine. Note: Compilation might take a while to finish
$ make # make install
In order to make sure the installed software is there, list the contents of /opt directory by running the following command.
$ ls -lah /opt
Now, that you have successfully installed MySQL server on your Linux machine, its time to initialize the databases. Click here for more info on how to do that.
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.