# Installing MySQL on Linux Using Generic Binaries
- Create a mysql User and Group.
groupadd mysql | |
useradd -r -g mysql -s /bin/false mysql |
- 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 |
- Create directories and grant permissions.
cd mysql | |
mkdir mysql-files | |
chmod 750 mysql-files | |
chown mysql:mysql mysql-files |
- 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 |
- 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 |