#!/bin/bash
#Please make sure that your yum is OK .
#Please put two packages (cmake-2.8.5.tar and mysql-5.5.11.tar) in root
cd /root
tar zxvf cmake-2.8.5.tar.gz -C /usr/local/src
mount -a
cd /usr/local/src/cmake-2.8.5
yum install gcc* -y
./configure
make && make install
mkdir -p /data/mysql
groupadd mysql
useradd -r -g mysql -d /data/mysql -s/sbin/nologin mysql
chown -R mysql.mysql /data/mysql
id mysql  &> /dev/null
cd /root
tar zxvf mysql-5.5.11.tar.gz -C /usr/local/src
yum install ncurses-devel -y
cd /usr/local/src/mysql-5.5.11
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5 -DDEFAULT_CHARSET=utf8 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
mv /etc/my.cnf /etc/my.cnf.bak
cd /usr/local/mysql5.5/support-files
cp my-medium.cnf /etc/my.cnf
#cd /usr/local/mysql5.5/support-files
cp mysql.server  /etc/init.d/mysqld
cd /usr/local/mysql5.5/scripts
./mysql_install_db --user=mysql --basedir=/usr/local/mysql5.5 --datadir=/data/mysql
cat << EOF >>/etc/my.cnf
datadir       =/data/mysql
EOF
/etc/init.d/mysqld start
  qq小新958676590