Download the installation package
Download MARIADB 10.2 Series stable version of the source package to the official website
Select Source Package
Click the link after the page will jump to the download page, the page has a message form can fill, here we skip directly, click No Thanks, just take me to the download, save the source package
Save the source package to:
/usr/local/src/
Extract:
Tar zxvf mariadb-10.2. tar.gz.
Pre-compilation preparation work
To install the MARIADB dependency package:
Yum-y Install readline-devel zlib-devel openssl-devel libaio-devel
Create the installation directory and data directory for the database:
mkdir/usr/local/mysql/
mkdir/data/
To add a MySQL user and user group:
Groupadd-g mysql-s/sbin/nologin-m MySQL
Give directory permissions:
Chown mysql:mysql/data/
Start compiling the installation
Enter the installation directory after decompression:
CD mariadb-10.2. /
Compilation settings:
-dcmake_install_prefix=/usr/local/-dmysql_datadir=/-dsysconfdir=/-dwithout_tokudb= 1 -dmysql_unix_addr=/tmp/-ddefault_charset=-ddefault_collation=utf8_general_ci
Parameter description:
-dcmake_install_prefix #指定安装路径
-dmysql_datadir #指定数据目录
-dsysconfdir #指定数据库的配置文件所在目录, generally stored in/etc directory
-dwithout_tokudb #这个参数一般都要设置, a value of 1 means that the TOKUDB engine is not installed
-ddefault_charset #设置默认字符集
-ddefault_collation #设置默认编码
Note: If an error occurs at compile time, you can delete CMakeCache.txt, or you will get an error if you use the correct command:
RM-RF CMakeCache.txt
Compile and install:
Make && make install
Follow-up work completed for installation
Go to the MySQL installation directory and execute the commands separately:
Cd/usr/local/mysql
Chown-R mysql:mysql. /scripts/mysql_install_db--datadir=/data--user=-R root:root. CPSupport-files/mysql.server/etc/ Init.d/mysqld
Mysql:mysql.
Add Mysqld to System services:
Chkconfig--add mysqld # added to System services Chkconfig mysqld on # set boot up
To create a log file:
mkdir/var/log/mariadb
To establish a sock soft link:
Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
To run the service:
Support-files/mysql.server start
Log in to MySQL, the default user password is root:
./bin/mysql-u ' Root '-p
Login success:
CentOS 7 under MARIADB source Package compilation Installation