Download the .tar.gz from the MySQL website (www.mysql.com):
place it in /usr/local and unpack the .tar.gz with the following command:
tar -xzf mysql-5.1.31-linux-i686-glibc23.tar.gz
(We have assumed from a real case that the version is 5.1.31, in which case the file name is mysql-5.1.31-linux-i686-glibc23.tar.gz). Create the MySQL symbolic link:
ln -s mysql-5.1.31-linux-i686-glibc23 mysql
Create the users and groups:
groupadd mysql
useradd -g mysql mysql
Initialize the database:
cd mysql
./scripts/mysql_install_db --user=mysql
Add the necessary permissions to the directories:
chown -R root:mysql .
chown -R mysql:mysql data
Start the MySQL daemon in the background with the following command:
./bin/mysqld_safe --user=mysql &
Configure the environment variables in your shell configuration file (e.g., /root/.bashrc or ~/.bashrc) by adding the following lines:
MYSQL=/usr/local/mysql
export MYSQL
PATH=$MYSQL/bin:.:$PATH
export PATH
Also, add these lines to /etc/init.d/bootmisc.sh to handle the automatic start-up of the MySQL service:
MYSQL=/usr/local/mysql
export MYSQL
PATH=$MYSQL/bin:.:$PATH
export PATH
