基础软件
yum install
bison bison-devel zlib-devel libcurl-devel
libarchive-devel boost-devel gcc gcc-c++
cmake ncurses-devel gnutls-devel libxml2-devel
openssl-devel libevent-devel libaio-devel
rm -f CMakeCache.txt /* 如果出错 */
解压
tar xvf mariadb-10.2.15.tar.gz
编译
编译选项
https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html
cd mariadb-10.2.15/
cmake . \
-DCMAKE_INSTALL_PREFIX=/app/mysql \
-DMYSQL_DATADIR=/data/mysqldb/ \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITHOUT_MROONGA_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/app/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make -j 4 && make install
路径变量
echo PATH=/app/mysql/bin:$PATH > /etc/profild.d/mysql.sh
. /etc/profild.d/mysql.sh
建立数据库
创建用户
useradd -r -s /sbin/nologin mysql
创建路径
mkdir -pv /data/mysqldb
chown mysql.mysql /data/mysqldb/
生成数据库
cd /app/mysql/
scripts/mysql_install_db –datadir=/data/mysqldb/ –user=mysql –basedir=/app/mysql /* show variables like “basedir”(‘%basedir%’) */
/* 二进制安装 编译安装 需要指明 */
配置文件
cp support-files/my-huge.cnf /etc/my.cnf
启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
setfacl -R -m u:mysql:rwx /app/mysql/
service mysqld restart
chkconfig –add mysqld
service mysqld start
本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/101615