#!/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