MariaDB compilation and installation, mariadb Compilation
1. Create a user
useradd -r -s /sbin/nologin mysql
2. Download and decompress the Software Package
wget http://mirrors.neusoft.edu.cn/mariadb//mariadb-10.2.12/source/mariadb-10.2.12.tar.gz
tar xvf mariadb-10.2.12.tar.gz
3. Package groups required for Installation
yum groupinstall "development tools"
yum install cmake
yum install ncurses-devel
yum install gnutls-devel
yum install libevent-devel
yum install libaio-devel
yum install openssl-devel
yum install libxml2-devel
4. Create a database directory and set the owner Group
mkdir /mysqldbchown -R mysql.mysql /mysqldb
V. Compilation and Installation
cd mariadb-10.2.12/
Cmake .\
-DCMAKE_INSTALL_PREFIX =/app/mysql \
-DMYSQL_DATADIR =/mysqldb /\
-DSYSCONFDIR =/etc \
-DMYSQL_USER = mysql \
-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 =/app/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DENABLED_LOCAL_INFILE = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DWITH_DEBUG = 0 \
-DWITHOUT_MROONGA_STORAGE_ENGINE = 1
make && make install
Vi. Environment Variables
echo 'PATH=/app/mysql/bin/:$PATH' > /etc/profile.d/mysql.sh. /etc/profile.d/mysql.shchmod +x /etc/profile.d/mysql.sh
VII. Generate a database
/app/mysql/scripts/mysql_install_db --basedir=/app/mysql --datadir=/mysqldb --user=mysql
8. Program Directory Permissions
chgrp -R mysql /app/mysql/chmod 775 /app/mysql/
IX. Configuration File
cp /app/mysql/support-files/my-huge.cnf /etc/my.cnf
vim /etc/my.cnf
10. Startup Script
cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
11. Start the service
service mysqld start
12. test connection