Compiling and installing the MARIADB database on CentOS

Source: Internet
Author: User
Tags mysql create prepare

I. Installation prerequisites (Prepare data files, install other dependent software)

1, prepare the data storage directory

[[email protected] ~]# fdisk/dev/sdb (fdisk/dev/sdb Create a logical partition/DEV/SDB1)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0xa592b386.
Changes'll remain in memory only, until the decide to write them.
After that, of course, the previous content won ' t is recoverable.

Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite)

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').

Command (M for help): n
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-652, default 652): +2g

Command (M for help): W
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks

[Email protected] ~]# fdisk-l

disk/dev/sda:16.1 GB, 16106127360 bytes
255 heads, Sectors/track, 1958 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000bd13b

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 1959 15215616 8e Linux LVM

disk/dev/sdb:5368 MB, 5368709120 bytes
255 heads, Sectors/track, 652 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xa592b386

Device Boot Start End Blocks Id System
/DEV/SDB1 1 262 2104483+ Linux

disk/dev/mapper/volgroup-lv_root:14.0 GB, 13967032320 bytes
255 heads, Sectors/track, 1698 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000


disk/dev/mapper/volgroup-lv_swap:1610 MB, 1610612736 bytes
255 heads, Sectors/track, 195 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/o size (min Imum/optimal):

[[email protected] ~]# PVCREATE/DEV/SDB1 (create Logical volume)
Physical volume "/DEV/SDB1" successfully created
[Email protected] ~]# vgcreate MYNG/DEV/SDB1
Volume Group "Myng" successfully created
[Email protected] ~]# lvcreate-l 1g-n mydata/dev/myng
Logical volume "MyData" created.
[[email protected] ~]# mke2fs-t ext4/dev/myng/mydata (formatted logical volume)
MKE2FS 1.41.12 (17-may-2010)
File System label =
Operating system: Linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing Inode table: complete
Creating Journal (8192 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete

This filesystem'll be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
[Email protected] ~]# Mkdir-pv/mydata/data
mkdir: The directory "/mydata" has been created
mkdir: The directory "/mydata/data" has been created

[[email protected] ~]# mkdir-pv/mydata/data (Create data directory)
mkdir: The directory "/mydata" has been created
mkdir: The directory "/mydata/data" has been created

[[email protected] ~]# Vim/etc/fstab (Mount logical volume to data directory and add to boot auto mount)

#
#/etc/fstab
# Created by Anaconda on Thu Dec 31 06:00:39 2015
#
# Accessible filesystems, by reference, is maintained under '/dev/disk '
# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info
#
/DEV/MAPPER/VOLGROUP-LV_ROOT/EXT4 Defaults 1 1
Uuid=8da37a95-1c26-48ab-8f4c-216c4eab8c18/boot EXT4 Defaults 1 2
/dev/mapper/volgroup-lv_swap swap swap defaults 0 0
TMPFS/DEV/SHM TMPFS Defaults 0 0
Devpts/dev/pts devpts gid=5,mode=620 0 0
Sysfs/sys Sysfs Defaults 0 0
PROC/PROC proc Defaults 0 0
/dev/myng/mydata/mydata/data EXT4 Defaults 0 0

2. Install dependent packages

[Email protected] ~]# yum-y install readline-devel zlib-devel openssl-devel cmake gcc-c++ gcc boost boost-devel bison bi Son-devel

Second, compile and install mariadb

1. Software download

[Email protected] ~]# wget http://archive.mariadb.org//mariadb-5.5.45/source/mariadb-5.5.45.tar.gz

2. How to view Maridb compiled parameters

[Email protected] ~]# Tar XF mariadb-5.5.45.tar.gz
[Email protected] ~]# CD mariadb-5.5.45
[Email protected] mariadb-5.5.45]# CMake. -lh

The common compilation parameters are as follows:

-dcmake_install_prefix=/usr/local/mysql

-dmysql_datadir=/data/mysql-dsysconfdir=/etc-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1- Dwith_blackhole_storage_engine=1-dwith_federated_storage_engine=1-dwith_readline=1-dwith_ssl=system-dwith_zlib =system-dwith_libwrap=0-dmysql_tcp_port=3306-dmysql_unix_addr=/tmp/mysql.sock-denabled_local_infile=1-dextra_ Charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dwith_debug=0-denable_profiling=13, Compile and install Mariadb[[email protected] mariadb-5.5.45] #cmake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/mydata/data/-dsysconfdir=/etc-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

[[email protected] mariadb-5.5.45]# make && make install

Third, configure the MARIDB service

1. Create MySQL users and groups

[[Email protected] ~] #groupadd-r MySQL create MySQL group

[[email protected] ~] #useradd-G mysql-r-d/mydata/data create MySQL user [[email protected] ~] #chown mysql:mysql/ Mydata/data change the genus of the data directory 2, prepare the MARIADB script and configuration file initialization database [[email protected] ~] #cd/usr/local/mysql[[email  Protected] MySQL] #chown-R mysql:mysql *  change genera Group [[email protected] MySQL] #scripts/mysql_install_db-- Datadir=/mydata/data--user=mysql Initialize library file [[[email protected] MySQL] #chown-r root * Change the owner to provide script for root [[email  Protected] ~] #cd/usr/local/mysql[[email protected] MySQL] #cp support-files/mysql.server /etc/rc.d/ INIT.D/MYSQLD provides script [[email protected] MySQL] #chmod +x/etc/rc.d/init.d/mysqld   gives execute permission [[email  Protected] MySQL] #chkconfig--add mysqld   add mysqld for system service [[email protected] MySQL] #chkconfig mysqld on& nbsp;     Add a configuration file for boot boot [[email protected] ~] #cd/usr/local/mysql[[email protected] MySQL] #cp support-files/my-large.cnf /etc/my.cnf[[email protected] MySQL] #vim/etc/my.cNF Edit configuration file [Mysqld] paragraph fill in the following [Mysqld]datadir = /mydata/data   data Directory thread_concurrency = 4  Set Number of threads = Core number X2innodb_file_per_table=no provide binary files [email protected] mysql]# echo ' export path=/usr/local/mysql/bin: $PATH ' >/etc/profile.d/mysql.sh [email protected] mysql]# source/etc/profile.d/mysql.sh (question 1:Linux command-line report Bash:.....:command not found workaround

The linux command line input command executes after "Bash:....:command not found" this is due to the system path setting problem, path is not set, the system will not be able to find the exact command.

1. Enter in the command line: Export Path=/usr/bin:/usr/sbin:/bin:/sbin:/usr/x11r6/bin This guarantees that command-line commands can be used temporarily. Do not shut down Terminal 2 and correctly write the path file after executing the command (provide library file # echo '/usr/local/mysql/lib ' >/etc/ld.so.conf.d/mysql.conf provide header file # ln-sv/usr/ Local/include/usr/include/mysql offers man Handbook # echo ' Manpath/usr/local/mysql ' >>/etc/man.config# man-m/usr/local/ Mysql/man mysqld Let the man manual take effect immediately up to date) Start MySQL database service [[email protected] MySQL] #service mysqld start[[email protected] MySQL] #ss- NTL | grep:3306

Compiling and installing the MARIADB database on CentOS

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.