mariadb编译安装

时间:2021-08-01 04:20:53

  1. 下载源码包
    • 进网站选 5.5 mariadb
    • 传到要安装的主机
  2. 解包
    tar -zxvf mariadb-5.5.66.tar.gz
  3. 安装包

    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 libdb-cxx-devel
  4. cmake 编译安装

    cmake .       -DCMAKE_INSTALL_PREFIX=/app/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 && make install
    # 提示:如果出错,执行rm -f CMakeCache.txt
  5. 准备环境变量

    echo 'PATH=/app/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
    . /etc/profile.d/mysql.sh
  6. 生成数据库文件

    cd /app/mysql/
    scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql
  7. 准备配置文件

    cp /app/mysql/support-files/my-huge.cnf /etc/my.cnf
  8. 准备启动脚本

    cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld
  9. 启动服务

    chkconfig --add mysqld ;service mysqld start