mariadb 10.5.0 编译安装

环境准备

[root@mariadb ~]# hostnamectl 
   Static hostname: mariadb
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 5330a01e60544f83bcd3032f4d7ae3e0
           Boot ID: 8742c4969d32455c8028eefd27557d74
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.el7.x86_64
      Architecture: x86-64

安装依赖环境

[root@mariadb ~]# yum -y install openssl openssl-devel ncurses ncurses-devel bison bison-devel jemalloc jemalloc-devel centos-release-scl devtoolset-7  gcc gcc-c++ cmake
[root@mariadb ~]# cmake -version
cmake version 2.8.12.2

下载源码包/编译安装

[root@mariadb ~]# wget https://downloads.mariadb.org/interstitial/mariadb-10.5.0/source/mariadb-10.5.0.tar.gz
[root@mariadb ~]# tar xf mariadb-10.5.0.tar.gz
[root@mariadb ~]# cd mariadb-10.5.0
[root@mariadb ~]# sed -i "s@data/test@\${INSTALL_MYSQLTESTDIR}@g" sql/CMakeLists.txt &&
mkdir build &&
cd    build &&
cmake -DCMAKE_BUILD_TYPE=Release                      \
      -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb          \
      -DINSTALL_DOCDIR=share/doc/mariadb-10.5.0       \
      -DINSTALL_DOCREADMEDIR=share/doc/mariadb-10.5.0 \
      -DINSTALL_MANDIR=share/man                      \
      -DINSTALL_MYSQLSHAREDIR=share/mysql             \
      -DINSTALL_MYSQLTESTDIR=share/mysql/test         \
      -DINSTALL_PLUGINDIR=lib/mysql/plugin            \
      -DINSTALL_SBINDIR=sbin                          \
      -DINSTALL_SCRIPTDIR=bin                         \
      -DINSTALL_SQLBENCHDIR=share/mysql/bench         \
      -DINSTALL_SUPPORTFILESDIR=share/mysql           \
      -DMYSQL_DATADIR=/data                    \
      -DMYSQL_UNIX_ADDR=/tmp/mysql.sock       \
      -DWITH_EXTRA_CHARSETS=complex                   \
      -DWITH_EMBEDDED_SERVER=ON                       \
      -DSKIP_TESTS=ON                                 \
      -DTOKUDB_OK=0                                   \
      .. &&
make && make install

初始化配置

[root@mariadb ~]# vim /etc/my.cnf
[root@mariadb ~]# mkdir /auth_pam_tool_dir /var/log/mariadb 
[root@mariadb ~]# touch /auth_pam_tool_dir/auth_pam_tool  && chown mysql.mysql /auth_pam_tool_dir -R  && chown mysql.mysql /var/log/mariadb
[root@mariadb ~]# mysql_install_db --basedir=/usr --datadir=/srv/mysql --user=mysql && chown mysql.mysql /srv/mysql -R
配置文件
[client]
#password       = your_password
port            = 3306
socket          = /run/mysqld/mysqld.sock
# The MySQL server
[mysqld]
port            = 3306
socket          = /run/mysqld/mysqld.sock
datadir         = /srv/mysql
log-error = /var/log/mariadb/mariadb.log
server-id       = 1
innodb_data_home_dir = /data
innodb_log_group_home_dir = /data
innodb_data_file_path = ibdata1:12M:autoextend
innodb_buffer_pool_size = 128M
innodb_log_file_size = 48M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

启动
[root@mariadb ~]#  mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &
停止
[root@mariadb ~]#  mysqladmin -p'*****'  shutdown

你可能感兴趣的:(关系型数据库,OP)