1.安装cmake
上传tar包
rz cmake-2.8.8.tar.gz
解压tar包,并进入解压后的文件夹
tar xf cmake-2.8.8.tar.gz
cd cmake-2.8.8
编译和安装
./configure
gmake && gmake install
2.安装MysqL
rz MysqL-5.5.32.tar.gz
解压MysqL-5.5.32.tar.gz
tar xf MysqL-5.5.32.tar.gz
进入到MysqL-5.5.32
cd MysqL-5.5.32
useradd MysqL -s /sbin/nologin -M
yum 安装依赖库
yum install ncurses-devel -y
指定cmake编译参数
cmake . -DCMAKE_INSTALL_PREFIX=/application/MysqL-5.5.32 \
-DMysqL_DATADIR=/application/MysqL-5.5.32/data \
-DMysqL_UNIX_ADDR=/application/MysqL-5.5.32/tmp/MysqL.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMbedDED_SERVER=1 \
-DWITH_DEBUG=0
编译和安装
make && make install
添加环境变量到profile
echo 'export PATH=/application/MysqL/bin:$PATH' >>/etc/profile
source /etc/profile
echo $PATH
复制my-small.cnf配置文件到/etc/下并改名为my.cnf
cp /tools/MysqL-5.5.32/support-files/my-small.cnf /etc/my.cnf
授权data tmp目录的属组和用户
3.初始化数据库
cd /application/MysqL/scripts/
./MysqL_install_db --basedir=/application/MysqL/ --datadir=/application/MysqL/data/ --user=MysqL
复制启动脚本到/etc/init.d/下并改名为MysqLd
给MysqLd赋予可执行权限
chmod +x /etc/init.d/MysqLd
启动MysqLd
/etc/init.d/MysqLd start
检查MysqLd是否启动起来
netstat -luptn |grep MysqLd
给MysqLd设置开机启动