#注意,本脚本在redhat5.0以后版本或者centos5.0以后版本,运行,需要先安装开发工具和开发库软件组。
#!/bin/bash
cd
useradd mysql
wget    http://122.225.32.131/icons/mysql-5.0.22.tar.gz
tar -zxvf mysql-5.0.22.tar.gz
cd      mysql-5.0.22
mkdir   /usr/local/mysql
./configure     \
--prefix=/usr/local/mysql       \
--without-debug \
--enable-thread-safe-client \
--enable-assembler \
--enable-profiling \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--with-charset=latin1 \
--with-extra-charsets=all  \
--with-big-tables       \
--enable-largefile      \
make && make install
cd /etc
rm -f my.cnf
wget http://122.225.32.131/icons/my.cnf
cd /usr/local/mysql/bin
./mysql_install_db --user=mysql
./mysqld_safe   --user=mysql    &
cp /root/mysql-5.0.22/support-files/mysql.server  /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
sleep 3
mysql -uroot mysql -e "delete from user where user = '';"