#!/bin/bash
yum install -y gcc gcc-c++ > /dev/null
rpm -qa | grep "mysql"
if [ $? -eq 0 ]
then
tar zxf /root/mysql-5.1.62.tar.gz -C /usr/local/src
cd /usr/local/src/mysql-5.1.62
# chuang jian shu ju ku de cun chu lu jin
if [ -d /data/mysql ]
then
useradd -u 27 -d /data/mysql/ -s /sbin/nologin mysql
chown -R mysql.mysql /data/mysql
else
mkdir -p /data/mysql
useradd -u 27 -d /data/mysql/ -s /sbin/nologin mysql
chown -R mysql.mysql /data/mysql
fi
./configure --prefix=/usr/local/mysql \
--sysconfdir=/etc \
--localstatedir=/usr/local/mysql \
--with-charsel=utf8 \
--with-extra-charsets=gbk,gb2312,utf8,ascii
make
make install
make clean
make distclean
cp /usr/local/mysql155/support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=myslq --basedir=/usr/local/mysql155/ --datadir=/data/mysql/
cat << ok >> /etc/my.cnf
[mysqld]
datadir =/data/mysql
ok
/etc/init.d/mysqld restart
else
yum remove mysql -y
fi
阅读(2301) | 评论(0) | 转发(0) |