当前位置:Gxlcms > mysql > mysql5.5.21源码编译_MySQL

mysql5.5.21源码编译_MySQL

时间:2021-07-01 10:21:17 帮助过:8人阅读

bitsCN.com 最近开始学习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 : hotseason007@gmail.com"
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) bitsCN.com

人气教程排行