MDLog:/sysadmin

The Journal Of A Linux Sysadmin

Install MySQL 5.0.51a From the Binary tar.gz Package

| Comments

MySQL offers for download several precompiled types of packages for installation (rpm’s for various distros, tar.gz, etc.). This post will show how you can install the latest version of mysql5.0 available at this time 5.0.51a from the binary tar.gz distribution.

Fist you need to download somewhere on your system the tar.gz package from mysql (I will assume you have done this inside /usr/local/src/), mysql-5.0.51a-linux-i686-glibc23.tar.gz from the closest mysql mirror to your location. If you are running a different architecture, please download the appropriate file.

Next, let’s create the mysql user and group:

1
2
groupadd mysql
useradd -g mysql mysql

And continue with the actual installation:

1
2
3
4
5
6
7
cd /usr/local
gunzip < /usr/local/src/mysql-5.0.51a-linux-i686-glibc23.tar.gz | tar xvf -
ln -s mysql-5.0.51a-linux-i686-glibc23 mysql
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .

The mysqld binary will search for configuration file under: /etc/my.cnf, /my.cnf and /my.cnf . You can start with one of the supplied configs (my-small.cnf, my-medium.cnf, my-large.cnf, my-huge.cnf or my-innodb-heavy-4G.cnf) and customize it accordingly to your needs. I chosen to put this one under /usr/local/mysql, so I can have more mysql instances running, each with its local my.cnf:

1
2
cp support-files/my-medium.cnf my.cnf
vim my.cnf

Once you are happy with the config you can start mysql manually using:

1
bin/mysqld_safe --user=mysql &

You can stop it manually with:

1
/usr/local/mysql/bin/mysqladmin shutdown

Once you are satisfied with everything you can setup mysql to start automatically at system boot time. You can use for this the supplied mysql.server from support-files folder.

Comments