(a)下载mysqld源码并解压
cd /usr/local/src;
wget wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz;
tar zxvf /usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz;

(b)迁移mysql至/usr/local目录并重命名
mv /usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql;

(c)创建mysql用户
useradd -M -s /sbin/nologin mysql;

(d)创建/data/mysql目录,并更改属组及属主
chown -R mysql:mysql /data/mysql;

(e)安装mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql;

(f)拷贝配置文件及修改
cp support-files/my-large.cnf /etc/my.cnf;
sed -i '/^\[mysqld\]$/a\datadir = /data/mysql' /etc/my.cnf;

(g)拷贝启动文件及更改权限
cp support-files/mysql.server /etc/init.d/mysqld;
sed -i 's#^datadir=#datadir=/data/mysql#'/etc/init.d/mysqld;
chmod 755 /etc/init.d/mysqld;