最近開始學習php,很都書籍裡都是mysql,於是也把mysql部署出來了,其實一個不同就是發現mysql轉到cmake 平台下了... 那下面分享出我的腳本...
[plain] view plaincopyprint?
echo "========================================================================="
echo "mysql install shell script for CentOS/RadHat Written by Qzi"
echo "creatred in 2012/3/5"
echo "last modified in 2012/3/6"
echo "Email : [email protected]"
echo "========================================================================="
echo "========================================================================="
echo "MySQL Version: 5.5.21"
echo "========================================================================="
o "============================mysql install=================================="
LNPP_ROOT=/tmp/lnpp/lnpp-0.05
MYSQL_VERSION=mysql-5.5.21
MYSQL_ROOT=$LNPP_ROOT/mysql/$MYSQL_VERSION
if [ -d $MYSQL_VERSION.tar.gz ]; then
echo "$MYSQL_VERSION.tar.gz is [found]"
else
# wget -c http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.5/mysql-5.5.21.tar.gz
echo ""
fi
if [ -d cmake-2.8.7.tar.gz ]; then
echo "cmake-2.8.7.tar.gz is [found]"
else
# wget -c http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
echo ""
fi
mkdir -p $LNPP_ROOT/cmake/cmake-2.8.7
tar -zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./bootstrap --prefix=$LNPP_ROOT/cmake/cmake-2.8.7
make
make install
cd ../
mkdir -p $MYSQL_ROOT/etc
mkdir -p $MYSQL_ROOT/data
tar -zxvf $MYSQL_VERSION.tar.gz
cd $MYSQL_VERSION
$LNPP_ROOT/cmake/cmake-2.8.7/bin/cmake \
-DCMAKE_INSTALL_PREFIX=$MYSQL_ROOT \
-DMYSQL_DATADIR=$MYSQL_ROOT/data \
-DSYSCONFDIR=$MYSQL_ROOT/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
#-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
make
make install
if [ $(id -nu mysql) = "mysql" ]; then
echo "user mysql is found ... "
else
echo "creating the user called 'mysql'"
su - -c "useradd -M mysql"
fi
cp support-files/my-small.cnf $MYSQL_ROOT/etc/my.cnf
chmod 755 $MYSQL_ROOT/scripts/mysql_install_db
$MYSQL_ROOT/scripts/mysql_install_db --user=mysql --basedir=$MYSQL_ROOT --datadir=$MYSQL_ROOT/data
#chmod +x /etc/init.d/mysqld
#cp support-files/mysql.server /etc/init.d/mysqld
echo "============================mysql install=================================="
配置:
#vim $MYSQL_ROOT/etc/my.cnf
[mysqld]
datadir=/tmp/lnpp/lnpp-0.05/mysql/mysql-5.5.21/data
啟動
#$MYSQL_ROOT/support-files/mysql.server start
建立了一個linux +php群,歡迎一起學習(QQ群號:213572677)