Compiling and installing MARIADB
- Download mariadb
# wget http://mirrors.opencas.cn/mariadb//mariadb-10.1.8/source/mariadb-10.1.8.tar.gz
- Decompression MARIADB
# TAR-ZXVF mariadb-10.1.8.tar.gz && CD mariadb-10.1.8
- Installing dependent software
# yum-y Install gcc-c++ cmake ncurses-devel Bison libxml2-devel openssl-devel
- compiling and installing MARIADB
#cmake . -dcmake_install_prefix=/usr/local /mysql -dmysql_datadir=/data/mysql - dsysconfdir=/etc
If you compile an error, you need to remove CMakeCache.txt and then recompile
# after installing the dependent software; Make && make install
- Create MARIADB service run users and user groups
# Groupadd MySQL
# useradd-g mysql -s/bin/nologin MySQL
- Create a MARIADB Data directory and modify the genus Group
# mkdir-p/data/mysql && chown-r mysql:mysql/data/mysql
- According to server performance, copy the corresponding MARIADB configuration file
# CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
- Installing the MARIADB Database
#/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/data/mysql--user=mysql
- Create a mariadb startup script
# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
- Set up the MARIADB service to boot from
# chmod +x/etc/init.d/mysqld
# Chkconfig Mysqld on
- Start the MARIADB service
# service Mysqld Start
- Set MARIADB System Variables
# echo "Export path=\ $PATH:/usr/local/mysql/bin" >/etc/profile.d/mysqld.sh
# source/etc/profile.d/mysqld.sh
- Initializing the MARIADB Security configuration
# mysql_secure_installation
Note:
Compile parameter list
# CMake. -dcmake_install_prefix=/usr/local/MySQL-dmysql_datadir=/data/MySQL-dsysconfdir=/etc-dmysql_user=MySQL-dwith_innobase_storage_engine=1 -dwith_archive_stprage_engine=1 -dwith_blackhole_storage_engine=1 -dwiyh_readline=1 -dwiyh_ssl=system-dvith_zlib=system-dwith_lobwrap=0 -dmysql_tcp_port=3306 -dmysql_unix_addr=/tmp/Mysql.sock-ddefault_charset=UTF8-ddefault_collation=utf8_general_ci
If you want to specify MARIADB installation location and data directory location, you can modify the/etc/init.d/mysqld
basedir=/usr/local/Mysqldatadir=/data/mysql
Yum installation mariadb
- Add MariaDB repo
# Vi/etc/yum.repo.d/mariadb.repo
# MariaDB 10.1 CentOS repository list-created 2015 -12 - : 46 utc# http: // mariadb.org/mariadb/repositories/ [Mariadb]name = Mariadbbaseurl = Http:// yum.mariadb.org/10.1/centos7-amd64 Gpgkey=https: // yum.mariadb.org/rpm-gpg-key-mariadb gpgcheck= 1
- Installing MARIADB
# yum-y Install Mariadb-server mariadb-client
- Set up the MARIADB service to boot from
# Systemctl Enable MARIADB
- Start the MARIADB service
# Systemctl Start mariadb
- Initializing the MARIADB Security configuration
# mysql_secure_installation
Create MySQL Users and user groups
Install MARIADB on REDHAT7