centos6.0编译安装mysql5.5脚本

到官网下载MySQL-5.5.21-1.linux2.6.src.rpm

把rpm包放到home中在,切换到这个目录下,输入或直接运行下面的脚本就行了

yum -y install gcc gcc-c++ make cmake ncurses-devel bison

rpm -ivh MySQL-5.5.21-1.linux2.6.src.rpm

cd rpmbuild/SOURCES/
tar -zxvf mysql-5.5.21.tar.gz
cd mysql-5.5.21
cmake ./ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DINSTALL_DATADIR=/usr/local/mysql/data
make
make install
groupadd mysql  
useradd -r -g mysql mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql  
chown -R root .
cp support-files/mysql.server /etc/init.d/mysql
service mysql start
chkconfig --add mysql
chkconfig mysql on
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

你可能感兴趣的:(centos,职场,休闲)