One-click Automation to install MySQL server

Source: Internet
Author: User

Statement

The Stars last night

Blog:http://yestreenstars.blog.51cto.com/

This article by oneself creation, if need reprint, please indicate source, thank cooperation!

Objective

One-click Automation to install MySQL server.

Environment

Os:centos 6.2 32

mysql:5.6.20

Configuration

#!/bin/bash# script name: one-key automatic install mysql server#  Author: yestreenstars# create time: 2014-08-18mysql_user_root_password= "Redhat" CMAKE_ install_prefix= "/usr/local/mysql" mysql_datadir= "/wwwroot/data" default_charset= "UTF8" default_collation= "utf8_ General_ci "echo -n "--installing related software ... "YUM -Y INSTALL GCC  gcc-c++ make cmake bison ncurses-devel unzip wget perl >  /dev/null 2>&1 && echo  "completed!" echo -n  "--installing mysql-server ..." (useradd -m -s /sbin/nologin  mysqlmkdir -p  $MYSQL _datadirchown -r mysql:mysql  $MYSQL _datadirwget -p /tmp / http://dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6.20.tar.gztar xzf /tmp/ Mysql-5.6.20.tar.gz -c /usr/src/cd /usr/src/mysql-5.6.20/cmake -dcmake_install_prefix= $CMAKE _install_prefix -dmysql_datadir= $MYSQL _datadir -ddefault_charset= $DEFAULT _ charset -ddefault_collation= $DEFAULT _collationmakemake install)  > /dev/null 2> &1 && echo  "completed!" echo -n  "--initializing ..." (Cd /usr/local/mysql/./scripts/mysql_install_db --user=mysql  --basedir= $CMAKE _install_prefix --datadir= $MYSQL _datadir/bin/cp -f  $PWD/support-files/ mysql.server /etc/init.d/mysqld/bin/cp -f  $PWD/support-files/my-default.cnf /etc/ my.cnfecho  "Path= $CMAKE _install_prefix/bin/: $PATH"  >> /etc/profilechkconfig --add  mysqldchkconfig mysqld onservice mysqld start$cmake_install_prefix/bin/mysqladmin  -uroot password  $MYSQL _user_root_password)  > /dev/null 2>&1  && echo  "completed!"

After running the above script, you need to run the following command manually:

Source/etc/profile


This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1541562

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.