suse11.3源码编译安装mysql5.7.27

suse11.3编译mysql5.7.27

  • 下载gmp mpc mpfr的源码包(源码编译gcc需要)

https://ftp.gnu.org/pub/gnu/gmp/gmp-6.1.2.tar.xz
https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.gz
https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz

  • 下载gcc4.8.5(支持c++11即可)源码包

ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.8.5/gcc-4.8.5.tar.gz

  • 下载openssl源码包(源码编译cmake需要)

https://www.openssl.org/source/openssl-1.1.1c.tar.gz

  • 下载cmake源码包(suse11.3没有cmake 源码编译mysql需要cmake)

https://codeload.github.com/Kitware/CMake/zip/master

  • 下载boost1.59源码包(源码编译mysql需要 必须是1.59版本)

https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

  • 下载mysql5.7.27源码包

https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.27.tar.gz

  • 将以上源码包解压后放在一个临时文件夹 比如/tmp/mysql 依次编译

    cd gmp-6.1.2
    ./configure
    make -j4
    make install
    ldconfig

    cd …
    cd mpfr-4.0.2
    ./configure
    make -j4
    make install
    ldconfig

    cd …
    cd mpc-1.1.0
    ./configure
    make -j4
    make install
    ldconfig

    cd …
    cd gcc-4.8.5
    ./configure --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++
    make -j4
    make install
    rm /usr/local/lib64/libstdc++.so.6.0.19-gdb.py
    ldconfig

    ln -sf /usr/local/bin/g++ /usr/bin/c++
    ln -sf /usr/local/bin/g++ /usr/bin/g++
    ln -sf /usr/local/bin/gcc /usr/bin/cc
    ln -sf /usr/local/bin/gcc /usr/bin/gcc
    ln -sf /usr/local/bin/cpp /usr/bin/cpp
    ln -sf /usr/local/bin/gcov /usr/bin/gcov

    cd …
    cd openssl-1.1.1c
    ./config
    make -j4
    make install
    ldconfig

    cd …
    cd CMake-master
    ./configure
    gmake -j4
    make install
    ldconfig

    cd …
    mkdir mysql_build
    cd mysql_build
    cmake …/mysql-5.7.27
    -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
    -DMYSQL_DATADIR=/usr/local/mysql/data
    -DDOWNLOAD_BOOST=1
    -DWITH_BOOST=/tmp/mysql
    -DENABLED_LOCAL_INFILE=1
    -DSYSCONFDIR=/etc/mysql
    make -j4
    make test
    make install DESTDIR="/usr/local/mysql"
    make package

    groupadd mysql
    useradd -r -g mysql -s /bin/false mysql
    cd /usr/local/mysql
    mkdir mysql-files
    chown mysql:mysql mysql-files
    chmod 750 mysql-files
    bin/mysqld --initialize-insecure --user=mysql
    bin/mysql_ssl_rsa_setup
    bin/mysqld_safe --user=mysql &
    cp support-files/mysql.server /etc/init.d/mysql
    chkconfig --add mysql

    ./mysql-test/mysql-test-run rpl_flush_logs

你可能感兴趣的:(mysql)