#!/bin/shif [ -s /etc/my.cnf ];thenrm -rf /etc/my.cnffiecho "-------------- --------------------start install mysql -----------------------------"yum install -y ncurses gcc gcc-c++ ncurses ncurses-devel openssl openssl-devel libtool* cmakemkdir -p /data/mysqlif [ ' grep "MySQL" /etc/passwd | wc -l ' ]; thenecho "Adding user mysql" groupadd mysqluseradd -s /sbin/nologin -M -g mysql mysqlelseecho "Mysql user exists" Fiecho "-------------------------------downloading mysql----------------------------------" wget http ://dev.mysql.com/get/downloads/mysql-5.5/mysql-5.5.46.tar.gz echo "------------------------------ unpackaging mysql -----------------------------------"TAR -XVF MYSQL-5.5.46.TAR.GZ CD mysql-5.5.46 echo&nBSP; " -------------------------configuring mysql,please wait-----------------"Cmake -dcmake_install_ Prefix=/usr/local/mysql \-dmysql_unix_addr=/tmp/mysql.sock \-ddefault_charset=utf8 \-ddefault_ Collation=utf8_general_ci \-dwith_extra_charsets:string=utf8,gbk \-dwith_myisam_storage_engine=1 \-dwith_innobase_storage_engine=1 \-dwith_memory_storage_engine=1 \-dwith_readline=1 \- denabled_local_infile=1 \-dmysql_datadir=/var/mysql/data \-dmysql_user=mysqlif [ $? - ne 0 ];thenecho "configure failed ,please check it out!" exit 1fiecho "Make mysql, please wait for 20 minutes" makeif [ $? -ne 0 ];thenecho "make failed ,please check it out!" exit 1fimake installchown -r mysql:mysql /usr/local/mysqlchown -r Mysql.mysql /data/mysql//usr/local/mysqL/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql#chown -r mysql /usr/local/mysql/varchgrp -r mysql /usr/local/mysql/cp -f ./ support-files/my-large.cnf /etc/my.cnf sed -i ' s#^thread_concurrency = 8#& \ndatadir = /data/mysql#g '  /ETC/MY.CNFCP ./SUPPORT-FILES/MYSQL.SERVER /ETC/RC.D /init.d/mysqlchmod 755 /etc/init.d/mysql#chkconfig --add mysqld#chkconfig --level 2345 mysqld onln -s /usr/local/mysql/lib/mysql /usr/lib/mysqlln -s / usr/local/mysql/include/mysql /usr/include/mysqlln -s /usr/local/mysql/bin/mysql /usr/bin/ mysqlln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldumpln -s /usr/local/mysql/ Bin/myisamchk /usr/bin/myisamchkln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_ safeecho "Mysql&nbSp;starting "/usr/local/mysql/bin/mysqld --user=mysqlif [ $? -ne 0 ];thenecho "mysql start filed ,please check it out!" elseecho "Mysql start successful,congratulations!" Fi
MySQL installation script