Ubuntu1604环境下编译安装mariadb10.2.26
作者:互联网
环境准备:阿里云ecs
Ubuntu1604下,编译安装mariadb10-2.26
1、先安装一些初试环境所需要的工具软件包
apt install -y iproute2 ntpdate tcpdump telnet traceroute nfs-kernel-server nfs-common lrzsz tree openssl libssl-dev \
libpcre3 libpcre3-dev zlib1g-dev ntpdate tcpdump telnet traceroute gcc openssh-server iotop unzip zip
apt安装一下依赖等
apt install cmake libncurses5-dev -y
否则编译过程中会提示:缺少依赖库文件
准备mariadb软件包,解压
tar xf tar xf mariadb-10.2.26.tar.gz
cd mariadb-10.2.26/
先创建一个mysql的系统用户
# groupadd mysql && useradd -g mysql -s /usr/sbin/nologin mysql # id mysql uid=1003(mysql) gid=1003(mysql) groups=1003(mysql)
检查环境&&编译&&安装
cmake . -DCMAKE_INSTALL_PREFIX=/apps/mysql \ -DMYSQL_DATADIR=/data/mysql/ \ -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=/data/mysql/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci && make -j2 && make install
继续执行编译
安装完成
准备环境变量
echo 'PATH=/apps/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
# cat /etc/profile.d/mysql.sh PATH=/apps/mysql/bin:$PATH
source /etc/profile.d/mysql.sh
初始化一下数据库
初始化,数据存放目录是/data/mysql/下
# pwd /apps/mysql # scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql
查看一下生成的数据库目录文件
拷贝mysql的配置文件到/etc/下命名为my.cnf
cp /apps/mysql/support-files/my-huge.cnf /etc/my.cnf
配置启动脚本
# cp /apps/mysql/support-files/mysql.server /etc/init.d/mysqld # ll /etc/init.d/mysqld -rwxr-xr-x 1 root root 12215 Dec 14 10:28 /etc/init.d/mysqld*
最后修改一下启动脚本的属主和属组的权限修改为mysql
# chown mysql.mysql /etc/init.d/mysqld # chown mysql.mysql /apps/mysql -R
# # /etc/init.d/mysqld start
查看状态
查看数据库mariadb的版本
安装完成
标签:mariadb10.2,ENGINE,26,apps,etc,init,mysql,DWITH,Ubuntu1604 来源: https://www.cnblogs.com/fengdejiyixx/p/12037644.html