40 用户权限管理及查询缓存、索引和explain、MariaDB存储引擎及编译安装、MySQL中的事务
2016-10-29 17:20
896 查看
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
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
相关文章推荐
- MariaDB四之锁、存储引擎、隔离级别、事务、用户及权限管理、日志管理
- mysql_用户权限管理&存储引擎&索引
- 上课笔记第三十一天MySQL并发控制、引擎、用户权限管理、查询缓存
- 第三十一天 MySQL并发控制、存储引擎介绍、用户权限管理、缓存管理和数据类型选择
- MySQL用户、权限、缓存、索引、日志管理
- MySQL用户、[表库字段]权限、管理及查询缓存详解
- mysql中索引,触发器,事务,存储引擎的理解
- mysql-5.6.14免编译安装和用户管理
- MySQL密码管理、存储引擎及事务
- Maridb编译安装及存储引擎、事务
- mysql用户管理及查询缓存
- MariaDB存储引擎及编译安装
- mysql免编译安装和用户管理
- Mysql存储引擎&查询缓存
- mysql+asp.net开发注意大全:mysql创建数据库的时候,创建新用户,并且付给权限。mysql存储过程的编写,mysql数据库引擎的区别,mysql数据库文件夹备份
- Mysql(四)- 存储引擎和事务,备份和恢复,索引,存储过程
- mysql存储引擎、索引及事务
- mysql的优化(表的设计,优化步骤,四种索引,分析慢查询,使用索引的深入解析,存储引擎分析,表的分割,数据库配置)
- MySQL学习笔记之五:存储引擎和查询缓存
- MySQL(十)之权限管理和查询缓存