Preface: MARIADB Database management system is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL licensing MARIADB is fully compatible with MySQL, including the API and command line, so that it can easily become a substitute for MySQL. For the storage engine, use XtraDB (English: XtraDB) instead of the MySQL InnoDB. MARIADB, led by MySQL's founder Michael Widenius (English: Michael Widenius), sold his company, MySQL AB, to Sun for $1 billion earlier, and since Sun was acquired by Oracle, MySQL's ownership also falls into Oracle's hands. Mariadb name comes from Michael Widenius's daughter Maria's name.
mariadb based on Transactions of Maria Storage Engine , replacing the MySQL of the MyISAM storage engine, which uses a variant of the Percona Xtradb,innodb, the branch developer wants to provide access to the upcoming MySQL 5.4 InnoDB performance. This version also includes the PrimeBase XT (PBXT) and Federatedx storage engines .
Preparation: Prepare the binary installation package, here I use the latest mariadb-10.2.8-linux-x86_64.tar.gz
(1) useradd-r-m-d/app/dbdata-s/sbin/nologin MySQL
(2) Prepare data directory take/app/dbdata as an example, it is recommended to use logical volume, the data file is relatively large.
Chown Mysql:mysql/app/dbdata
(3) Unzip the installation package to the appropriate directory
Tar xvf mariadb-version-linux-x86_64.tar.gz-c/usr/local
This is placed in the/usr/local directory because the decompression path specified in the installation package is here
Cd/usr/local into the installation package directory
LN-SV mariadb-version mysql Create a soft link
Or you can change your name directly.
MV Mariadb-10.2.8-linux-x86_64 MySQL
Note: The default file directory name is MySQL
Chown-r Root:mysql/usr/local/mysql
(4) Prepare configuration file Configuration format: Class INI format, each program is provided by a single configuration file with [ProG_name] Profile lookup order: After overwriting the previous configuration file
/ETC/MY.CNF--/ETC/MYSQL/MY.CNF----default-extrafile=/path/to/conf_file-~/.my.cnf mkdir/etc/mysql/
Note: The order of the files determines the priority, the file takes effect
CP support-files/my-large.cnf/etc/mysql/my.cnf #这里我们自定义配置文件
Note: The Support-files directory has a collection of templates, with support for small, medium, large, super-large database configuration files
/ETC/MYSQL/MY.CNF Copy from the template directory above and then customize the configuration file
Add three options in [mysqld]:
DataDir =/app/dbdata
innodb_file_per_table = on InnoDB database engine
Skip_name_resolve = ON disables hostname resolution
(5) Create a database file
Cd/usr/local/mysql
./scripts/mysql_install_db--datadir=/app/dbdata--user=mysql
Note: The execution of the script must be in this relative path, or it will be an error
Example: FATAL error:could not find./bin/my_print_defaults
Primarily to generate information about database-related systems
Note: When minimizing the installation, some system files are not and must be installed manually before possible
Example: Error message:./bin/mysqld:error while loading shared libraries:libaio.so.1:cannot open Shared object file:no such file or di Rectory
Missing installation packages Libaio and Libaio-devel
Yum Install libaio* installation is ready.
(6) Preparing the log file
cd/var/log/
Mkdir/var/log/mariadb
Touch/var/log/mariadb/mariadb.log
Chown-r root:mysql/var/log/mariadb
Chmod-r g+w/var/log/mariadb
Note: At this point, it should be noted that in the MySQL group must have write permissions, otherwise you can not log, start the service error
(7) Prepare the service script and start the service
CP./support-files/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Service mysqld Start
export Path=/usr/local/mysql/bin: $PATH
Note: Build path Path
(8) Security initialization
/user/local/mysql/bin/mysql_secure_installation
Note: The security environment modifies the script
Manually installing the binary mariadb on the CENTOS7