Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mariadb compiles the installation script

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report