MySQL Service installation: one-click installation script

Source: Internet
Author: User

#!/bin/sh#user : bobo365#date : 20160127make () {         if [  ' echo $? '  -eq 0 ] ;then                          Make                 else                          exit        fi}make_ins () {         if [  ' echo $? '  -eq 0 ] ;then                          make install                 else                         exit        fi}user= ' WhoAmI ' if [  ' $USER  !=  ' root '  ] ;then         echo  "This is not root user. "        exitfiif [ -d  '/usr/local/mysql '  ] ; then                echo  "Mysql data directory has been created."         else                 mkdir -p /usr/local/mysql/datafimysql_user= ' Egrep -i  MYSQL /ETC/PASSWD ' if [ -z  "$MYSQL _user"  ] ;then                 useradd -s /sbin/nologin -m  mysql        else                 echo  "The mysql user was added" Fiyum install -y screen gcc gcc-c++ autoconf automake ncurses-devel  sysstat man bash-completion expect bzip2 bzip2-devel wget -o / usr/local/src/cmake-3.3.2.tar.gz https://cmake.org/files/v3.3/cmake-3.3.2.tar.gztar -zxf /usr/ local/src/cmake-3.3.2.tar.gz -c /usr/local/src/cd /usr/local/src/cmake-3.3.2/ &&   ./bootstrapmake && make_inswget -o /usr/local/src/mysql-5.6.26.tar.gz  http://ftp.ntu.edu.tw/mysql/downloads/mysql-5.6/mysql-5.6.26.tar.gztar -zxf /usr/local/src/ Mysql-5.6.26.tar.gz -c&nBSP;/USR/LOCAL/SRC/CD&NBSP, .... /mysql-5.6.26  && cmake -dcmake_install_prefix=/usr/local/mysql/ -dmysql_unix _addr=/tmp/mysql.sock -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci -dwith_extra_ Charsets=all -dwith_perfschema_storage_engine=1 -dwith_federated_storage_engine=1 -dwith_ partition_storage_engine=1 -dwith_archive_storage_engine=1 -dmysql_datadir=/data/mysql/data - Dsysconfdir=/usr/local/mysql/ -dwith_ssl=bundled -denabled_local_infile=1 -dwith_innobase_ storage_engine=1 -dwith_blackhole_storage_engine=1 -dmysql_user=mysql -dmysql_tcp_port=3306  -denable_downloads=1make && make_ins/usr/local/mysql/scripts/mysql_install_db -- datadir=/usr/local/mysql/data --user=mysql --basedir=/usr/local/mysql/mv /etc/my.cnf /etc/ My.cnf_bakcp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnfcp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqldsed -i  ' s/^#  basedir = ...../basedir = \/usr\/local\/mysql/g '  /etc/my.cnfsed -i  ' s /^# datadir = ...../datadir = \/usr\/local\/mysql\/data/'  /etc/my.cnfsed -i   ' s/^# port = ...../port = 3306/'  /etc/my.cnfsed -i  ' s/^#  socket = ...../socket = \/tmp\/mysql.sock/'  /etc/my.cnf/etc/init.d/mysqld  startchkconfig --add mysqld && chkconfig mysqld onecho  "PATH= $PATH :/usr/local/mysql/bin " >> /etc/profile. /etc/profileproc= ' Ps aux|grep mysql  |grep -v grep -c ' port= ' netstat -lnp|grep 3306 ' if [ ! -z  "$ PORT " ] && [ " $PROC " -ne 0 ]  ;then          echo  "Mysql install and started secussefull" fi 


This article is from the "Bobo365 Road" blog, please be sure to keep this source http://bobo365.blog.51cto.com/1035992/1738847

MySQL Service installation: one-click installation script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.