#!/bin/bash
cd /root/soft
tar zxvf cmake-2.8.5.tar.gz
cd cmake-2.8.5
./bootstrap
make
make install
yum install -y libaio-devel ncurses-devel
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
mkdir -p /data/mysqlp
chown mysql.mysql /data/mysqlp
cd /root/soft
tar zxvf Percona-Server-5.5.32-rel31.0.tar.gz
cd Percona-Server-5.5.32-rel31.0
/usr/local/bin/cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql_p -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF
make && make install
chmod 755 /usr/local/mysql_p
chown mysql.mysql -R /usr/local/mysql_p
mkdir /usr/local/mysql_p/etc
cp /root/soft/my.cnf /usr/local/mysql_p/etc/
/usr/local/mysql_p/scripts/mysql_install_db --basedir=/usr/local/mysql_p/ --datadir=/data/mysqlp/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
yum remove mysql -y
rm -rf /usr/bin/mysql*
ln -s /usr/local/mysql_p/bin/mysql* /usr/bin/
service mysqld start
/usr/local/mysql_p/bin/mysqladmin -u root password "123"
注:Percona Mysql版本为:5.5.32 软件包请自行下载!