groupadd mysql;

useradd -s /sbin/nologin -g mysql -M mysql;

mkdir -p /home/wangxu/tools/;

mkdir /application;

cd /home/wangxu/tools/;

wget http://mysql.ntu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.68.tar.gz;

tar -zxf mysql-5.1.68.tar.gz;

cd mysql-5.1.68;

./configure --prefix=/application/mysql5.1.68 \

--with-unix-socket-path=/application/mysql5.1.68/tmp/mysql.sock \

--localstatedir=/application/mysql5.1.68/data \

--enable-assembler --enable-thread-safe-client --with-mysqld-user=mysql \

--with-big-tables --without-debug  --with-pthread  --enable-assembler \

--with-extra-charsets=complex --with-readline --with-ssl \

--with-embedded-server --enable-local-infile  \

--with-plugins=partition,innobase \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static ;

make && make install;

ln -s /application/mysql5.1.68 /application/mysql;

/bin/cp support-files/my-small.cnf /etc/my.cnf;

mkdir  /application/mysql/data;

chown -R mysql.mysql /application/mysql/data;

/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql;

echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile;

source /etc/profile;

cp support-files/mysql.server /etc/init.d/mysqld;

chmod 700 /etc/init.d/mysqld;

chkconfig --add mysqld;

chkconfig  mysqld on