MySQL Service installation two: Binary mode one-click installation script

Source: Internet
Author: User


#!/bin/bash
#User: bobo365
#Date: 20160127

User= ' WhoAmI '
If ["$USER"! = ' root '); then
echo "Please use root user,thanks"
Exit
Fi

Mysql_user= ' Egrep-i mysql/etc/passwd '
If [-Z ' $MYSQL _user]; then
Useradd-r-s/sbin/nologin MySQL
Else
echo "user MySQL was added"
Fi

Yum install-y vim screen lsof gzip unzip tree NTP Curl wget libaio*

Wget-o/usr/local/src/mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/ Mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz

Cd/usr/local/src
TAR-ZVXF mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
MV Mysql-5.6.26-linux-glibc2.5-x86_64/usr/local/mysql

cd/usr/local/
Chown-r Mysql.mysql mysql/
CD mysql/support-files/
CP Mysql.server/etc/init.d/mysql
Chkconfig--add MySQL
Chkconfig--level MySQL on
Cd.. /data/.
scripts/mysql_install_db--user=mysql &

Mv/etc/my.cnf/etc/my.cnf_bak
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Sed-i ' s/^# basedir = .../basedir = \/usr\/local\/mysql/g '/etc/my.cnf
Sed-i ' s/^# datadir = .../datadir = \/usr\/local\/mysql\/data/'/etc/my.cnf
Sed-i ' s/^# port = .../port = 3306/'/etc/my.cnf
Sed-i ' s/^# socket = .../socket = \/tmp\/mysql.sock/'/etc/my.cnf

chmod 755/etc/init.d/mysqld
/etc/init.d/mysql start
echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profile
Source/etc/profile

Proc= ' 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

#mysql-S/tmp/mysql.sock


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

MySQL Service installation two: Binary mode one-click 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.