centos 编译安装MYSQL8

2019-11-10  本文已影响0人  Sirius之剣

需要高版本cmake和gcc

yum install cmake3 -y

yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
scl enable devtoolset-8 bash

需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。
如果要长期使用gcc 8的话:

echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

/usr/bin/ 设置gcc编译器的软连接cc和c++

sudo ln -s /usr/local/bin/gcc /usr/bin/cc
sudo ln -s /usr/local/bin/g++ /usr/bin/c++
    tar zvxf mysql-boost-8.0.18.tar.gz
    cd mysql-8.0.18/
    mkdir build
    cd build

    make_clean
    echo "configure in progress ..."
    cmake3 .. -DCMAKE_INSTALL_PREFIX=$IN_DIR/mysql-8.0.18 \
    -DMYSQL_DATADIR=$IN_DIR/mysql-8.0.18/data \
    -DDOWNLOAD_BOOST=1 \
    -DWITH_BOOST=boost/boost_1_70_0/ \
    -DSYSCONFDIR=/www/wdlinux/etc \
    -DWITH_INNOBASE_STORAGE_ENGINE=1 \
    -DWITH_PARTITION_STORAGE_ENGINE=1 \
    -DWITH_FEDERATED_STORAGE_ENGINE=1 \
    -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
    -DWITH_MYISAM_STORAGE_ENGINE=1 \
    -DWITH_EMBEDDED_SERVER=1 \
    -DENABLE_DTRACE=0 \
    -DENABLED_LOCAL_INFILE=1 \
    -DDEFAULT_CHARSET=utf8mb4 \
    -DDEFAULT_COLLATION=utf8mb4_general_ci \
    -DEXTRA_CHARSETS=all
    [ $? != 0 ] && err_exit "mysql configure err"
    echo "make in progress ..."
    make -j $CPUS
    [ $? != 0 ] && err_exit "mysql make err"
    echo "make install in progress ..."
    make install 
    [ $? != 0 ] && err_exit "mysql install err"
上一篇下一篇

猜你喜欢

热点阅读