Shell script automatically compiles and installs MySQL

Source: Internet
Author: User

1.1. Shell script automatically compiles and installs MySQL

1, enter the script fixed directory, write the automatic installation MySQL script

cd/server/scripts/

Vim zidong_bianyi-install_mysql.sh

#!/bin/bash

. /etc/init.d/functions

Mysql_tool_dir= "/USR/LOCAL/SRC"

Mysql_install_dir= "/application/mysql"

mysql_version= "5.1.73"

echo "-------step 1:add mysql user--------"

Useradd-m-s/sbin/nologin MySQL

Sleep 1

echo "-------step 2:download mysql-------"

Mkdir-p ${mysql_tool_dir}

CD ${mysql_tool_dir}

[!-f mysql-${mysql_version}.tar.gz] && \

wget http://mirrors.163.com/mysql/downloads/mysql-5.1/mysql-${mysql_version}.tar.gz

echo "-------step 3:install mysql-------"

CD ${mysql_tool_dir}

Tar zxf mysql-${mysql_version}.tar.gz

CD Mysql-${mysql_version}

Mkdir-p ${mysql_install_dir}

./configure \

--prefix=${mysql_install_dir} \

--with-unix-socket-path=${mysql_install_dir} \

--localstatedir=${mysql_install_dir}/data \

--enable-assembler \

--enable-thread-safe-client \

--with-mysqld-user=mysql \

--with-big-tables \

--without-debug \

--with-pthread \

--enable-assembler \

--with-extra-charsets=complex \

--with-readline \

--WITH-SSL \

--with-embedded-server \

--enable-local-infile \

--with-plugins=partition,innobase \

--with-plugin-plugin \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static

If [$?-ne 0];then

Action "MySQL Configure"/bin/false

Exit 1

Fi

Make

If [$?-ne 0];then

Action "MySQL make"/bin/false

Exit 1

Fi

Make install

If [$?-ne 0];then

Action "MySQL make install"/bin/false

Exit 1

Fi

Action "MySQL is installed successfully"/bin/true

Save exit

Execute the script directly.

Dos2unix zidong_bianyi-install_mysql.sh

SH zidong_install_mysql.sh

Mistakes in the scripting process about MySQL compile install times error Resolution:

Error:

Checking for tgetent in-lncursesw ... no

Checking for tgetent in-lncurses ... no

Checking for tgetent in-lcurses ... no

Checking for tgetent in-ltermcap ... no

Checking for tgetent in-ltinfo ... no

Checking for termcap functions Library ... configure:error:No curses/termcap Library found,

Solve:

Yum-y Install Ncurses-devel

After the script executes successfully!

MySQL is installed successfully [OK]


Shell script automatically compiles and installs MySQL

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.