#!/bin/bash
useradd -s /sbin/nologin mysql
mkdir /data/mysql/data -p
mkdir /data/mysql/log -p
alias cp=cp
cp -f /root/my.cnf /etc
tar -xzf /root/Percona-Server-5.6.15-rel63.0-519.Linux.x86_64.tar.gz -C /usr/local
ln -s /usr/local/Percona-Server-5.6.15-rel63.0-519.Linux.x86_64 /usr/local/mysql
ln -s /usr/lib64/libssl.so /usr/lib64/libssl.so.6
ln -s /usr/lib64/libcrypto.so /usr/lib64/libcrypto.so.6
cd /usr/local/mysql
./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/
/etc/init.d/mysql start
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf.d/mysql-x86_64.conf
ldconfig
yum install -y libtool
cd /root
tar -xzf sysbench-0.4.12.tar.gz
mkdir /opt/sysbench
cd /root/sysbench-0.4.12
./configure --prefix=/opt/sysbench --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib
alias cp=cp
cp -f /usr/bin/libtool /root/sysbench-0.4.12
make && make install
ln -s /opt/sysbench/bin/sysbench /usr/bin/