MARIADB Compiling the installation script

Source: Internet
Author: User
Tags openssl

#!/bin/bash
#Date: 2017-04-23
#Author: Allen_jol
#mariadb_install_v1.0.sh
#Version: mariadb-10.1.22


mariadb_version= "Mariadb-10.1.22.tar.gz"
echo "MARIADB version: $MARIADB _version"
Pathway=/usr/local/src
CD $PATHWAY
echo "====================prepare======================"
echo "originally loaded or comes with MySQL as follows:"
Rpm-qa | grep MySQL
#如果是centos7.2 The Mariadb-libs is installed by default and must be uninstalled first.
#rpm-E--nodeps mariadb-libs


Sleep 3
#rm-rf/etc/my.cnf
Yum-y Remove mysql*
LS *.tar.gz | Xargs-n1 Tar zxvf
Sleep 5


Yum-y install libevent ' development Tools ' ncurses-devel openssl-devel OpenSSL gcc gcc-c++ cmake make


Sleep 3


Groupadd MySQL
Useradd-r-G MySQL mysql-s/sbin/nologin
Mkdir-p/usr/local/mysql/data
Chown-r Mysql:mysql/usr/local/mysql/data


Sleep 3


#编译安装开始
echo "==============mariadb install'll be-start for 3 seconds later========"
Sleep 3


if [!-F mariadb-10.1.22.tar.gz]
Then
echo "No $mariadb_version this package, please check!"
Sleep 3
Exit 1
Else
TAR-ZXVF $MARIADB _version
CD ${mariadb_version%.tar.gz}
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-dsysconfdir=/etc-dwithout_tokudb= 1-dwith_innobase_storage_engine=1-dwith_archive_stprage_engine=1-dwith_blackhole_storage_engine=1-dwiyh_ Readline=1-dwiyh_ssl=system-dvith_zlib=system-dwith_lobwrap=0-dmysql_unix_addr=/var/lib/mysql/mysql.sock- Ddefault_charset=utf8-ddefault_collation=utf8_general_ci
Fi


Sleep 3
echo $?
Sleep 3


#-j 2 represents a two-thread CPU to make, which is faster. LSCPU can see how much the CPU (s) is.
#make-j $ (grep processor/proc/cpuinfo | wc–l)
The #-j parameter indicates that the number of threads at compile time is specified based on the number of CPU cores, which speeds up compilation. Default is 1 thread compilation
#一个processor就是一个线程


Make-j 4
Sleep 1
Make install
echo $?


Chown-r mysql:mysql/usr/local/mysql/data/
/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data


Sleep 3



\cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
chmod 755/etc/init.d/mysql
\cp/usr/local/mysql/support-files/my-large.cnf/etc/my.cnf
Chkconfig--add MySQL
Chkconfig MySQL on
Echo ' Export path= $PATH:/usr/local/mysql/bin ' >>/etc/profile
Source/etc/profile
/etc/init.d/mysql start
Ps-ef | grep MySQL
echo "Remember to log in to the database to change the database password and refresh the permissions. "
echo "If you can't log in to the database directly with MySQL, please source/etc/profile it manually"
echo "=================mariadb installed successfully!===congratulation==="


This article is from the "12252646" blog, please be sure to keep this source http://12262646.blog.51cto.com/12252646/1947254

MARIADB Compiling the 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.