MySQL installation script

Source: Internet
Author: User

#!/bin/sh

#install MySQL

#check Install is not

Check_ok () {

If [$? = "0"];then echo-e "\033[32m The Install is not\033[0m";

Else

Echo-e "\033[33m is ok\033[0m"

Fi

}

#off the iptables and SELinux

Iptables-f

Service Iptables Save

Check_ok

If ["getenforce" = = "Enforcing"];then setenforce 0;sed-ir ' s/selinux=enforcing/selinux=disabled/g '/etc/selinux/ Config

Check_ok

else Echo-e "\033[32m the SELinux is off\033[3m"

Fi

#install MySQL

Cd/usr/local/src

Wget-c http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz

Tar xzf mysql-5.1.73-linux-x86_64-glibc23.tar.gz

Check_ok

MV Mysql-5.1.73-linux-x86_64-glibc23/usr/local/mysql && cd/usr/local/mysql &&/bin/cp support-files/ MY-LARGE.CNF/ETC/MY.CNF &&/BIN/CP Support-files/mysql.server/etc/init.d/mysqld

Sed-ir ' s#^basedir=$ #basedir =/usr/local/mysql#g '/etc/init.d/mysqld

Sed-ir ' s#^datadir=$ #datadir =/data/mysql#g '/etc/init.d/mysqld

Useradd MySQL &&/scripts/mysql_install_db--user=mysql--datadir=/data/mysql

Check_ok

Echo-n "Export path= $PATH:/usr/local/mysql/bin"/etc/profile.d/path.sh

source/etc/profile.d/path.sh

Chkconfig--add mysqld && chkconfig mysqld on

/etc/init.d/mysqld start

Check_ok


This article is from the "Learn Linux" blog, so be sure to keep this source http://10265013.blog.51cto.com/10255013/1764211

MySQL installation script

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.