@TOC#编译部署MySQL文档
#所需软件包mysql-5.5.22.tar.gz
#author:Mr.zhang
#注意事项:软件包必须放在root目录下,且为光盘挂载目录
##一,安装依赖cmake
cd ~ yum -y install ncurses-devel tar xf cmake-2.8.6.tar.gz -C /usr/src cd /usr/src/cmake-2.8.6/ ./configure && gmake && gmake install
##二,创建程序用户并安装MySQL
cd ~ useradd -M -s /sbin/nologin mysql tar xf mysql-5.5.22.tar.gz -C /usr/src cd /usr/src/mysql-5.5.22/ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc \ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all && make && make install
#三,对MySQL进行初始化配置
chown -R mysql:root /usr/local/mysql/ /bin/cp /usr/src/mysql-5.5.22/support-files/my-medium.cnf /etc/my.cnf /bin/cp /usr/src/mysql-5.5.22/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig mysqld --add chkconfig mysqld --list echo "export PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile . /etc/profile /usr/local/mysql/scripts/mysql_install_db --user=mysql \ --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
#四,启动mysql
/etc/inin.d/mysqld start