CentOS6.5 install MariaDB10.0.15 compilation and installation and multi-instance Management Configuration

Source: Internet
Author: User

CentOS6.5 install MariaDB10.0.15 compilation and installation and multi-instance Management Configuration

CentOS6.5 x86_64 System

[Root @ e3 ~] # Wget https://downloads.mariadb.org/interstitial/mariadb-10.0.15/source/mariadb-10.0.15.tar.gz/from/http%3A//mirrors.neusoft.edu.cn/mariadb
Groupadd-r mysql
Useradd-r-g mysql-s/sbin/nologin mysql
Mkdir/data/mydata {1 .. 3}
Chown-R mysql: mysql/data /*

Install
 
Yum-y install gcc-c ++ make cmake ncurses libxml2 libxml2-devel openssl-devel bison-devel # dependency Components
Decompress the MariaDB source code package.
Tar xf mariadb
Cd mariadb-10.0.15/
Cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/data/mydata-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 =/tmp/mysql. sock
-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci
Make-j 4-j 4 indicates that the 4-core processing can be compiled quickly.
Make install

Output Environment Variables

[Root @ e3 ~] # Vim/etc/profile. d/mysql. sh
Export PATH = $ PATH:/usr/local/mysql/bin/
[Root @ e3 mariadb-10.0.15] #./etc/profile. d/mysql. sh

Output the man help document for the header file library
 
Vim/etc/ld. so. conf. d/mysql. conf
/Usr/local/mysql/lib
[Root @ e3 mariadb-10.0.15] # vim/etc/man. config
MANPATH/usr/local/mysql/man
[Root @ e3 mariadb-10.0.15] # man-M/usr/local/mysql/man/mysqld
[Root @ e3 tmp] #/usr/local/mysql/scripts/mysql_install_db -- basedir =/usr/local/mysql/-- datadir =/data/mydata1 -- user = mysql

Provides configuration files and startup scripts

[Root @ e3 mariadb-10.0.15] # cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf
[Root @ e3 mariadb-10.0.15] # cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld
[Root @ e3 mariadb-10.0.15] # chmod + x/etc/init. d/mysqld ^ C
[Root @ e3 mariadb-10.0.15] # chkconfig mysqld on ^ C
[Root @ e3 mariadb-10.0.15] #/etc/init. d/mysqld start
Then test
Directly enter mysql

Multi-instance configuration runs on different ports 3306, 3307, 3308

Configuration files such as/etc/my. cnf
 
[Client]
# Password = your_password
# Port = 3306
# Socket =/tmp/mysql. sock
Default-character-set = utf8
 
# Here follows entries for some specific programs
[Mysqld_multi]
Mysqld =/usr/local/mysql/bin/mysqld_safe
Mysqladmin =/usr/local/mysql/bin/mysqladmin
User = root
Log =/var/log/mysql/mysqld. multi. log
# Password = # If your mysql instance has a password, you need to start and write the password. Otherwise, the management script can be started and cannot be stopped.
 
[Mysqld1]
Port = 3306
Socket =/tmp/mysql3306.sock
Pid-file =/tmp/mysql3306.pid
Max_allowed_packet = 1 M
Net_buffer_length = 2 k
Table_open_cache = 4
Sort_buffer_size = 64 k
Thread_stack = 128 k
Basedir =/usr/local/mysql
Datadir =/data/mydata1
Server-id = 1
 
[Mysqld2]
Port = 3307
Socket =/tmp/mysql3307.sock
Pid-file =/tmp/mysql3307.pid
Max_allowed_packet = 1 M
Net_buffer_length = 2 k
Table_open_cache = 4
Sort_buffer_size = 64 k
Thread_stack = 128 k
Basedir =/usr/local/mysql
Datadir =/data/mydata2
Server-id = 1
 
[Mysqld3]
Port = 3308
Socket =/tmp/mysql3308.sock
Pid-file =/tmp/mysql3308.pid
Max_allowed_packet = 1 M
Net_buffer_length = 2 k
Table_open_cache = 4
Sort_buffer_size = 64 k
Thread_stack = 128 k
Basedir =/usr/local/mysql
Datadir =/data/mydata3
Server-id = 1
#
# The MariaDB server

Multi-instance management script
 
[Root @ e3 mariadb-10.0.15] # cp/usr/local/mysql/support-files/mysqld_multi.server/etc/init. d/mysqld. multi
[Root @ e3 mariadb-10.0.15] # chmod + x/etc/init. d/mysqld. multi

Modify the multi-instance script to start at the same time and disable three instances

[Root @ e3 mariadb-10.0.15] # vim/etc/init. d/mysqld. multi

Edit and modify

#! /Bin/sh
#
# A simple startup script for mysqld_multi by Tim Smith and Jani Tolonen.
# This script assumes that my. cnf file exists either in/etc/my. cnf or
#/Root/. my. cnf and has groups [mysqld_multi] and [mysqldN]. See
# Mysqld_multi documentation for detailed instructions.
#
# This script can be used as/etc/init. d/mysql. server
#
# Comments to support chkconfig on RedHat Linux
# Chkconfig: 2345 64 36
# Description: A very fast and reliable SQL database engine.
#
# Version 1.0
#
 
Basedir =/usr/local/mysql
Bindir =/usr/local/mysql/bin
Conf =/etc/my. cnf
Export PATH = $ PATH: $ bindir
 
If test-x $ bindir/mysqld_multi
Then
Mysqld_multi = "$ bindir/mysqld_multi ";
Else
Echo "Can't execute $ bindir/mysqld_multi from dir $ basedir ";
Exit;
Fi
 
Case "$1" in
'Start ')
"$ Mysqld_multi" -- defaults-extra-file = $ conf start $2
;;
'Stop ')
"$ Mysqld_multi" -- defaults-extra-file = $ conf stop $2
;;
'Report ')
"$ Mysqld_multi" -- defaults-extra-file = $ conf report $2
;;
'Restart ')
"$ Mysqld_multi" -- defaults-extra-file = $ conf stop $2
"$ Mysqld_multi" -- defaults-extra-file = $ conf start $2
;;
*)
Echo "Usage: $0 {start | stop | report | restart}"> & 2
;;
Esac

To test!

[Root @ e3 mariadb-10.0.15] #/etc/init. d/mysqld. multi start 1, 2, 3
[Root @ e3 mariadb-10.0.15] # netstat-antlp | grep mysqld
Tcp 0 0: 3307: * LISTEN 20628/mysqld
Tcp 0 0: 3308: * LISTEN 20630/mysqld
Tcp 0 0: 3306: * LISTEN 20619/mysqld
[Root @ e3 mariadb-10.0.15] #/etc/init. d/mysqld. multi stop, 3
[Root @ e3 mariadb-10.0.15] # netstat-antlp | grep mysqld

How to connect to a database

[Root @ e3 tmp] # mysql-S/tmp/mysql3307.sock to connect
Welcome to the MariaDB monitor. Commands end with; or \ g.
Your MariaDB connection id is 2
Server version: 10.0.15-MariaDB Source distribution
 
Copyright (c) 2000,201 4, Oracle, SkySQL AB and others.
 
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
 
MariaDB [(none)]>
 
[Root @ e3 tmp] # mysql-uroot-h127.0.0.1-P3306-p can also be connected
Enter password:
Welcome to the MariaDB monitor. Commands end with; or \ g.
Your MariaDB connection id is 3
Server version: 10.0.15-MariaDB Source distribution
 
Copyright (c) 2000,201 4, Oracle, SkySQL AB and others.
 
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
 
MariaDB [(none)]>

And so on.

Install LAMP (Apache with MariaDB and PHP) in CentOS/RHEL/Scientific Linux 6)

Implementation of MariaDB Proxy read/write splitting

How to compile and install the MariaDB database in Linux

Install MariaDB database using yum in CentOS

Install MariaDB and MySQL

How to migrate MySQL 5.5 database to MariaDB 10 on Ubuntu

Install MariaDB on the Ubuntu 14.04 (Trusty) Server

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.