03 MariaDB存储引擎及编译安装
CentOS6.x下安装Mariadb
#准备MaridDB存储分区
[root@centos6 ~]# fdisk /dev/sda
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
Selected partition 4
First cylinder (5509-26108, default 5509):
Using default value 5509
Last cylinder, +cylinders or +size{K,M,G} (5509-26108, default 26108): +20G
Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@centos6 ~]# partx -a /dev/sda
[root@centos6 ~]# pvcreate /dev/sda4
dev_is_mpath: failed to get device for 8:4
Physical volume "/dev/sda4" successfully created
[root@centos6 ~]# vgcreate myvg /dev/sda4
Volume group "myvg" successfully created
[root@centos6 ~]# lvcreate -L 10G -n mydata myvg
Logical volume "mydata" created
[root@centos6 ~]# mke2fs -t ext4 /dev/myvg/mydata
[root@centos6 ~]# mkdir -p /mydata/
[root@centos6 ~]# vim /etc/fstab
添加
/dev/myvg/mydata /mydata ext4 defaults 0 0
[root@centos6 ~]# mount -a
[root@centos6 ~]# mkdir /mydata/data
[root@centos6 ~]# chown mysql.mysql /mydata/data/
[root@centos6 ~]# yum groupinstall "Development Tools" "Server Platform Development" -y
[root@centos6 ~]# yum -y install cmake
[root@centos6 ~]# groupadd -r -g 306 mysql
[root@centos6 ~]# useradd -r -g 306 -u 306 mysql
[root@centos6 ~]# tar xf mariadb-5.5.53.tar.gz
[root@centos6 ~]# cd mariadb-5.5.53
[root@centos6 ~]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb-5.5.53 \
-DMYSQL_DATADIR=/mydata/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
[root@centos6 mariadb-5.5.53]# make
[root@centos6 mariadb-5.5.53]# make install
[root@centos6 mariadb-5.5.53]# cd /usr/local/mariadb-5.5.53/
[root@centos6 mariadb-5.5.53]# chown -R root.mysql ./*
[root@centos6 local]# ln -s mariadb-5.5.53/ mysql
[root@centos6 local]# cd mysql/
[root@centos6 mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
[root@centos6 mysql]# mkdir /etc/mysql
[root@centos6 mysql]# cp support-files/my-large.cnf /etc/mysql/my.cnf
[root@centos6 mysql]# vim /etc/mysql/my.cnf
添加(41之后)
datadir = /mydata/data
innodb_file_per_table = ON
skip_name_resolve = ON
[root@centos6 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@centos6 mysql]# chmod +x /etc/rc.d/init.d/mysqld
[root@centos6 mysql]# chkconfig --add mysqld
[root@centos6 mysql]# service mysqld start
[root@centos6 mysql]# /usr/local/mysql/bin/mysql
本文出自 “追梦” 博客,请务必保留此出处http://sihua.blog.51cto.com/377227/1867150
40 用户权限管理及查询缓存、索引和explain、MariaDB存储引擎及编译安装、MySQL中的事务
原文地址:http://sihua.blog.51cto.com/377227/1867150