The method of compiling MARIADB database under CentOS6.4

Source: Internet
Author: User
Tags chmod mkdir

Example 1

Currently the official latest stable version is MariaDB-5.5.35 download address: https://downloads.mariadb.org/mariadb/5.5.35/

Before compiling, you first have to install the compilation tool and some other dependent packages:

The code is as follows Copy Code

Yum groupinstall-y "Developmen Tools"

Yum install-y cmake openssl-devel zlib-devel

Cd/webapp

wget https://downloads.mariadb.org/mariadb/5.5.35/

Groupadd MySQL
useradd-g MySQL mysql-s/sbin/nologin
Mkdir/webapp/mysql
Mkdir/usr/local/mysql
Chown Mysql:mysql/webapp/mysql
Chown Mysql:mysql/usr/local/mysql
TAR-ZXVF mariadb-5.5.35.tar.gz
cd/webapp/mariadb-5.5.25
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/webapp/mysql-dsysconfdir=/etc-dwith_ssl=system-dwith_ Federated_storage_engine=1-dwith_zlib=system-dmysql_unix_addr=/tmp/mysqld.sock-denabled_local_infile=1- Ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dmysql_user=mysql

After configuration is complete:


Make && make install

In fact, similar to a compile installation, the option becomes uppercase. For example: (-dcmake_install_prefix=/usr/local/mysql) corresponds to MySQL (–prefix=/usr/local/mysql), the other basic is the same.

When the configuration is complete, execute make for compilation. Compilation takes some time. Then install make install.

Initialization also has a few simple configurations:

The code is as follows Copy Code

Cp/usr/local/mysql/support-files/my-large.cnf/etc/my.cnf
Cp-p/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld
chmod +x/etc/rc.d/init.d/mysqld
Chkconfig–level mysqld 2345 on
Chkconfig–add mysqld
echo "DataDir =/data/mysql" >>/etc/my.cnf
echo "Basedir =/usr/local/mysql" >>/etc/rc.d/init.d/mysqld
echo "DataDir =/data/mysql" >>/etc/rc.d/init.d/mysqld
./scripts/mysql_install_db–user=mysql–datadir=/webapp/mysql &
Service mysqld Start

Access to the database:

By this, mariadb can be used normally.


Example 2

MARIADB version 5.2.10, whose


2. Extract Source Package
TAR-ZXF mariadb-5.1.2.10.tar.gz

3. Enter mariadb-5.2.10 (CD mariadb-5.2.10)
Some support class libraries need to be used in the compilation process only need Yum installation
Yum install gcc gcc-c++ make # (or there are other Baidu to fix, I only encountered in the process of compiling the need for these);
4. Configure

The code is as follows Copy Code
./configure--prefix=/usr/local/mysql/--with-extra-charsets=all

5.

The code is as follows Copy Code
Make & make Install

6.

The code is as follows Copy Code

Groupadd MySQL
useradd-g MySQL MySQL
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
Chown-r Root/usr/local/mysql
Chown-r Mysql/usr/local/mysql/var
Chgrp-r Mysql/usr/local/mysql
/usr/local/mysql/bin/mysqld_safe--user=mysql &
CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

Chown Root.root/etc/rc.d/init.d/mysqld
chmod 755/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Chkconfig--list mysqld
Chkconfig--levels 245 mysqld off

Ln/usr/local/mysql/bin/mysql/usr/bin/mysql

7. Modify/sbin/service file Www.111Cn.net

The code is as follows Copy Code

#!/bin/sh

. /etc/init.d/functions
Version= "$ (basename $) ver. 0.91"
Usage= "USAGE: $ (basename $) < option > | --status-all |
[service_name [Command |--full-restart]] "
Service=
Servicedir= "/ETC/INIT.D"
options=
If [$#-eq 0]; Then
echo "${usage}" >&2
Exit 1
Fi
CD/
While [$#-GT 0]; Todo
Case "${1}" in
--help | -H | --h*)
echo "${usage}" >&2
Exit 0
;;
--version | -V)
echo "${version}" >&2
Exit 0
;;
*)
If [-Z "${service}"-A $#-eq 1-a "${1}" = "--status-all"]; Then
CD ${servicedir}
For SERVICE in *; Todo
Case "${service}" in
Functions | Halt | Killall | single| Linuxconf| Kudzu)
;;
*)
if! Is_ignored_file "${service}"
&& [-X "${servicedir}/${service}"]; Then
Env-i path= "$PATH" term= "$TERM" "${servicedir}/${service}" status
Fi
;;
Esac
Done
Exit 0
elif [$#-eq 2-a "${2}" = "--full-restart"]; Then
Service= "${1}"
If [-X "${servicedir}/${service}"]; Then
Env-i path= "$PATH" term= "$TERM" "${servicedir}/${service}" stop
Env-i path= "$PATH" term= "$TERM" "${servicedir}/${service}" start
Exit $?
Fi
elif [-Z "${service}"]; Then
Service= "${1}"
Else
Options= "${options} ${1}"
Fi
Shift
;;
Esac
Done
If [f "${servicedir}/${service}"]; Then
Env-i path= "$PATH" term= "$TERM" "${servicedir}/${service}" ${options}
Else
echo $ "${service}: Unrecognized SERVICE" >&2
Exit 1
Fi

Errors may occur during compilation and you need to install GCC gcc-c++ make

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.