ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31


ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
?本文参考华为鲲鹏社区相关文档完成
https://www.huaweicloud.com/kunpeng/
系统为aarch64位的centos AltArch系统
ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
1、准备如下cmake gcc相关源码包cmakehttps://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
gcchttps://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
gcc所需的依赖包https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2
https://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
2、配置CentOS-AltArch-7 华为云yum源cp -a /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakwget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-AltArch-7.reposed -i "s/gpgcheck=1/gpgcheck=0/g" /etc/yum.repos.d/CentOS-Base.repoyum clean allyum makecache
ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 

ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
3、检查是否有安装cmake下载cmake源码包
下载地址 https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
编译cmake
cp /home/cmake-3.9.2.tar.gz /usr/local/srccd /usr/local/srctar -zxf cmake-3.9.2.tar.gzcd cmake-3.9.2./configuremake && make install测试cmake是否安装完成 cmake -version
ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 

ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 

ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
4、升级gcc gcc --versionyum install bison* ncurses*cd /hometar -zxf gcc-7.3.0.tar.gzcd gcc-build-7.3.0/./contrib/download_prerequisites#下载isl、gmp、mpc、mpfr的依赖包上传至该目录下cat /proc/cpuinfo| grep "processor"| wc -l #查看当前CPU核心数 , make编译时“-j”参数可利用多核CPU加快编译速度cd /home/gcc-7.3.0mkdir gcc-build-7.3.0cd gcc-build-7.3.0../configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usrmake -j1 #只有一核 , 若有多核 , 修改为对应核心数加快编译速度make install 
ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 

ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 

ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
验证gcc是否升级成功
cd /usr/lib64ll |grep libstdc++.so
ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
5、源码编译升级MySQL下载MySQL 5.7.31版本的源码包
ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31

文章插图
 
yum install openssl-devel.aarch64
yum install openssl-devel.aarch64http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
下载补丁文件 , 并放置到mysql-5.7.x路径下
【ARM版 CentOS-AltArch-7下源码编译安装MySQL5.7.31】补丁下载路径:https://bugs.mysql.com/file.php?id=28180&bug_id=94699
tar -zxf mysql-boost-5.7.31.tar.gz -C /home cd /homecp 0001-Bug-94699-Mysql-deadlock-and-bugcheck-on-aarch64.patch mysql-5.7.31/cd mysql-5.7.31/patch -p1 < 0001-Bug-94699-Mysql-deadlock-and-bugcheck-on-aarch64.patchvim cmake.sh#添加如下行-DWITH_BOOST=的路径为实际boost所在路径cmake . -DCMAKE_INSTALL_PREFIX=/data/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/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 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_EMBEDDED_SERVER=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/home/mysql-5.7.31/boost/boost_1_59_0/


推荐阅读