1. Prepare the directory where the database files are stored mariadb.
Mkdir/mydatacd/mydatamkdir datachown mysql:mysql Data #如本机没有mysql用户及组需新建系统用户, group example: Groupadd-r-G 306 Mysqluseradd-r-D/ Mydata/data-u 306-g 306 MySQL
Database files occupy a large amount of memory and are placed on logical volumes to ensure scalability. The following steps are required to configure the logical volume process, which you do not need, and go directly to the second step.
① Configuring logical volume partitions or new drives
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A5/F6/wKioL1nGSb_z3VDtAAKzElSXi3Q025.png "title=" 1.png "alt=" Wkiol1ngsb_z3vdtaakzelsxi3q025.png "/>② creating the Logical volume LV
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/07/45/wKiom1nGSsmiR5_3AAC29qUt1zw017.png "title=" 2.png "alt=" Wkiom1ngssmir5_3aac29qut1zw017.png "/>
③ uses XFS file system logical volumes to be extensible, as CentOS 6 does not support XFS file systems by default with the help of software xfsprogs.
Yum install xfsprogs-y #安装xfsprogsmodprobe xfs #加载xfs文件系统驱动mkfs. Xfs/dev/myvg/mydata #创建文件系统
④ Mount XFS File system
Vim/etc/fstab:r!blkid/dev/myvg/mydata uuid=1a5a90a2-2559-494f-954a-7177911e3535/mydata xfs defaults 0 0 M Ount-a
2. Configure and install MARIADB
① to the official website download mariadb binary installation package Https://downloads.mariadb.org/Centos 6 system recommended to install version 5 stable version, do not install more than 10 version. This article takes the installation mariadb-5.5.57-linux-x86_64.tar.gz as an example.
Tar xvf mariadb-5.5.57-linux-x86_64.tar.gz-c/usr/local #解压到/usr/localcd/usr/localln-sv mariadb-5.5.57-linux-x86_64 /MySQL #创建软连接chown-R root:mysql mysql/#递归修改文件属主属组
② Preparing the configuration file
configuration format: Class INI format, each program is provided by a single configuration file [Prog_name]
Configuration file Lookup Order: Overwrite the previous configuration file later
/ETC/MY.CNF--/ETC/MYSQL/MY.CNF----default-extrafile=/path/to/conf_file-~/.MY.CNF
MKDIR/ETC/MYSQLCP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-LARGE.CNF/ETC/MYSQL/MY.CNF #复制模板配置文件到/etc/mysql and renamed to My.cnfvim /ETC/MYSQL/MY.CNF found [mysqld] added three new configuration DataDir =/mydata/datainnodb_file_per_table = on #使用innodb引擎, each table is a separate database skip_name_ Resolve = on #禁止主机名解析, speed up
③ Creating a database file
cd/usr/local/mysqlscripts/mysql_install_db--user=mysql--datadir=/mydata/data #注意不要进入scripts目录执行
④ preparing the service script and starting the service
CP support-files/mysql.server/etc/init.d/mysqld #复制服务脚本并改名mysqldchkconfig--add mysqldchkconfig mysqld on #设为开机启动
⑤ preparing the log file and starting the service
Touch/var/log/mysqld.logchown Mysqld/var/log/mysqld.log Service mysqld start
⑥ Join Executable Path
Vim/etc/profile.d/mysql.shexport Path=/usr/local/mysql/bin: $PATH. /etc/profile.d/mysql.sh
⑦ Security Initialization
/user/local/mysql/bin/mysql_secure_installation #配置root密码, delete anonymous users, etc.
Installation is complete!
This article is from the Linux OPS blog, so be sure to keep this source http://arm2012.blog.51cto.com/2418467/1968224
CentOS 6 Installation binary format mariadb