One-click installation of MySQL Single instance

Source: Internet
Author: User

#!/bin/sh################################################ #Author: created by randolph  2016-04#blog:http://randolph.blog.51cto.com#function: this scripts function is  install mysql#version:4.1.2#################################################. /etc/init.d/ Functionsuid= ' id|awk -f  ' [= (]+ "  ' {print $1} ' if [  $uid  -ne 0 ]; then  action  "Only root can execute the script."  /bin/false  exit 1fiyum -y install ncurses ncurses-devel  openssl-devel bison gcc gcc-c++ cmake makeuseradd mysql -s /sbin/ nologin -mcd /home/zhangyiling/tools/mysqltar zxf mysql-5.5.32.tar.gz cd  mysql-5.5.32cmake . -dcmake_install_prefix=/application/mysql-5.5.32 -dmysql_datadir=/ Application/mysql-5.5.32/data -dmysql_unix_addr=/application/mysql-5.5.32/tmp/MYSQL.SOCK -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=0make && make  Install    if [ $? -ne 0 ];then    action   "install mysql is failed!"   /bin/falseexit $?fisleep 2ln -s /application/mysql-5.5.32/ /application/ Mysql/bin/cp  /home/zhangyiling/tools/mysql/mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf  cp /home/zhangyiling/tools/mysql/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld chmod 700 /etc/init.d/mysqld echo  "export PATH=/ Application/mysql/bin: $PATH ">>/etc/profilesource /etc/profilechown -r mysql.mysql / application/mysql/data//application/mysql/scripts/mysql_install_db  --basedir=/application/mysql/  --datadir=/application/mysql/data/ --user=mysqlif [ $? -ne 0 ];then     action  "install mysql is failed!"   /bin/false    exit $?fi/etc/init.d/mysqld startif [ $?  -ne 0 ];then    action  "mysql start is failed!"   /bin/false    exit $?fi/application/mysql/bin/mysql -e  "Select  version (); "  >/dev/null 2>&1if [ $? -eq 0 ];then    echo   "+---------------------------+"     echo  "+------MySQL Installation complete--------+"     echo  "+---------------------------+" fi 


This article from "Randolph" blog, reproduced please contact the author!

One-click installation of MySQL Single instance

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.