Get the App
SLTechnology News&Howtos  ›  Database  › 

Mariadb compiles the installation script

Shulou Source: shulou.com Published: 2022-06-01 11:19:59 10月03日 Update

#! / 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 is: $MARIADB_VERSION"

PATHWAY=/usr/local/src

Cd $PATHWAY

Echo "= PREPARE=="

Echo "the original installed or built-in mysql is as follows:"

Rpm-qa | grep mysql

# if mariadb-libs is installed by default in centos7.2, uninstall it 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

# compilation and installation begins

Echo "= mariadb install will be start for 3 seconds later="

Sleep 3

If [!-f mariadb-10.1.22.tar.gz]

Then

Echo "there is no $MARIADB_VERSION package, please check it!"

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 means to use cpu dual threads to make, which is fast. Lscpu can see what cpu (s) is.

# make-j $(grep processor / proc/cpuinfo | wc-l)

The #-j parameter specifies the number of threads at compile time according to the number of CPU cores, which can speed up the compilation speed. The default is 1 thread compilation

# A processor is a thread

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 permissions."

Echo "if you can't log in to the database directly with mysql, please manually source / etc/profile"

Echo "= Mariadb installed compliance ="

Tags: Compile thread data database speed login representative parameter password that is manual permission core version fast script Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi MySQL Apple Shulou Information