#!/bin/bash#by lctoolsdir=/application/toolsinstalldir=/applicationcmakefile= $TOOLSDIR/ cmake-3.2.2cmaketar= $TOOLSDIR/cmake-3.2.2.tar.gzmysqlfile= $TOOLSDIR/mysql-5.5.32mysqltar= $TOOLSDIR/ Mysql-5.5.32.tar.gzinstallmysql= $INSTALLDIR/mysql-5.5.32datadir=/application/mysql-5.5.32/datasockdir=/ application/mysql-5.5.32/tmp/mysql.sock. /etc/init.d/functionspanduan () { if [ $? -eq 0 ] then action " $1 " /bin/true else action " $1 " /bin/false exit 1 fi}function checkmysqldir () { [ ! -d $TOOLSDIR ] && mkdir -p $TOOLSDIR }function checkmysqltar () { if [ -n $MYSQLTAR ] then echo ' ######################################################################### ' echo ' PLEASE DO THIS ' Download mysql in this directory---/application/tools/"' echo ' ######################################################################### ' exit 1 fi#http://mirrors.sohu.com/mysql/mysql-5.5/mysql-5.5.44.tar.gz#http://mirror.yandex.ru/mirrors/ ftp.mysql.com/downloads/mysql-5.5/mysql-5.5.44.tar.gz#http://files.directadmin.com/services/all/mysql/ Mysql-5.5.44.tar.gz#https://downloads.mariadb.com/archives/mysql-5.5/mysql-5.5.44-linux2.6-x86_64.tar.gz#http ://ftp.ntu.edu.tw/pub/mysql/downloads/mysql-5.5/mysql-5.5.44.tar.gzif [ -n $CMAKETAR ] then echo ' ########################################################### ############## ' echo ' PLEASE DO THIS ' Download cmake in this directoRy---/application/tools/"' echo ' ################################################# ######################## ' exit 1 fi#wget http://www.cmake.org/files/v3.3 /cmake-3.3.0.tar.gz}function checkmysqluser () { if [ ' cat /etc/passwd|grep Mysql|wc -l ' -eq 0 ] then useradd mysql -s /sbin/nologin -m fi}function installmysql () { cd $ Toolsdir && yum install ncurses-devel libaio-devel -y && tar xf $ cmaketar && cd $CMAKEFILE && ./configure && gmake && gmake install &&        CD&NBSP, .... / && tar xf $MYSQLTAR && cd $MYSQLFILE && cmake . -dcmake_install_prefix= $INSTALLMYSQL -dmysql_datadir= $DATADIR -dmysql_ Unix_addr= $SOCKDIR -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=0panduan bianyi make && make install && #ln -s /application/mysql-5.5.32/ /application/mysql && sed -i ' 40 a pathmunge /application/mysql/bin ' /etc/profile && source /etc/profile chown -r mysql.mysql $INSTALLMYSQL panduan make}function startmysql () { /bin/cp $INSTALLMYSQL/ support-files/my-small.cnf /etc/my.cnf echo ' Path=/application/mysql/bin: $PATH ' > >/etc/profile source /etc/profile chown -R mysql.mysql $DATADIR chmod -R 1777 /tmp cd $INSTALLMYSQL/scripts/ ./mysql_ install_db --basedir= $INSTALLMYSQL --datadir= $DATADIR/ --user=mysql panduan CHUSHI cd $MYsqlfile \cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld /etc/init.d/mysqld start panduan start}main () { checkmysqldir checkmysqltar checkmysqluser tarmysql startmysql}main
This article is from the "10886311" blog, please be sure to keep this source http://10896311.blog.51cto.com/10886311/1723276
Installation of the shell MySQL