Installing MySQL on Linux Using Generic Binaries

  1. Create a mysql User and Group.
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
  1. Obtain and Unpack the Distribution.
cd /usr/local
tar zxvf /path/to/mysql-VERSION-OS.tar.gz
ln -s full-path-to-mysql-VERSION-OS mysql
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
  1. Create directories and grant permissions.
cd mysql
mkdir mysql-files
chmod 750 mysql-files
chown mysql:mysql mysql-files
  1. Create my.cnf configuration file.
cp -a /etc/my.cnf /etc/my.cnf_`date +%F`
cat > /etc/my.cnf << EOF
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
EOF
  1. Starting the MySQL Server.
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
bin/mysql_ssl_rsa_setup
bin/mysqld_safe --user=mysql &

# Next command is optional
# cp support-files/mysql.server /etc/init.d/mysql.server