MySQL 8.4.0 LTS版在2024年4月30号正式发布了,官网的发布说明在这里。
近期我更新了整个LAMP组件的编译安装,于是MySQL也是其中一环,就下载下来编译安装,试了下主从复制及恢复并完全更新了下文档;这里就摘取下文档中的编译安装、复制命令的更改以及记录一点查询恢复的语句命令。
安装依懒
编译环境和一些不易自编译的组件:
yum install -y gcc gcc-c++ ncurses-devel libaio-devel numactl-devel rpcgen openldap-devel dnf --enablerepo=crb install libtirpc-devel
自编译组件
下面这些可以按方法自行编译,也可以直接yum安装。
zlib
wget http://zlib.net/zlib-1.3.1.tar.xz tar Jxf zlib-1.3.1.tar.xz -C /usr/local/src/ cd /usr/local/src/zlib-1.3.1/ CFLAGS="-fPIC -O3" ./configure --shared --64 make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install chcon -R -u system_u -t lib_t /usr/local/lib/libz.so* semanage fcontext -a -t bin_t '/usr/local/bin(/.*)?' semanage fcontext -a -t lib_t '/usr/local/lib(/.*)?' semanage fcontext -a -t etc_t '/usr/local/etc(/.*)?' semanage fcontext -a -t man_t '/usr/local/man(/.*)?' restorecon -Rv /usr/local/ echo '# User Defined.' > /etc/ld.so.conf.d/complie.conf echo '/usr/local/lib' >> /etc/ld.so.conf.d/complie.conf cd -
OpenSSL
tar zxf openssl-3.3.1.tar.gz -C /usr/local/src/ cd /usr/local/src/openssl-3.3.1 yum install -y perl-IPC-Cmd perl-Pod-Html perl-FindBin perl-lib perl-File-Compare perl-File-Copy CFLAGS="-fPIC -O3" ./config --prefix=/usr/local/openssl shared threads zlib enable-md2 --release -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install echo 'export PATH=/usr/local/openssl/bin:$PATH' > /etc/profile.d/openssl.sh ldconfig source /etc/profile.d/openssl.sh openssl version cd -
Curl
wget https://curl.se/download/curl-8.8.0.tar.xz tar Jxf curl-8.8.0.tar.xz -C /usr/local/src/ cd /usr/local/src/curl-8.8.0/ CFLAGS="-fPIC -O3" LDFLAGS="-Wl,--enable-new-dtags,-rpath=/usr/local/lib:/usr/local/openssl/lib64" ./configure --prefix=/usr/local/curl --enable-optimize --enable-http --enable-ftp --enable-file --enable-rtsp --enable-libgcc --enable-cookies --enable-websockets --with-zlib=/usr/local/ --with-ssl=/usr/local/openssl/ make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install echo 'export PATH=/usr/local/curl/bin:$PATH' > /etc/profile.d/curl.sh source /etc/profile.d/curl.sh chcon -R -t lib_t /usr/local/curl/lib/libcurl.so* curl -V cd -
CMake
wget https://cmake.org/files/v3.29/cmake-3.29.5.tar.gz tar zxf cmake-3.29.5.tar.gz -C /usr/local/src/ cd /usr/local/src/cmake-3.29.5/ OPENSSL_ROOT_DIR=/usr/local/openssl LDFLAGS="-Wl,--enable-new-dtags,-rpath=/usr/local/lib:/usr/local/openssl/lib64:/usr/local/curl/lib" ./configure gmake -j `cat /proc/cpuinfo | grep processor | wc -l` && gmake install cd -
Bison
wget https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz tar Jxf bison-3.8.2.tar.xz -C /usr/local/src/ cd /usr/local/src/bison-3.8.2/ CFLAGS="-fPIC -O3" ./configure make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install cd -
rpcgen
wget https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4.4/rpcsvc-proto-1.4.4.tar.xz tar Jxf rpcsvc-proto-1.4.4.tar.xz -C /usr/local/src/ cd /usr/local/src/rpcsvc-proto-1.4.4/ CFLAGS="-fPIC -O3" ./configure make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install cd -
patchelf
wget https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0.tar.gz tar zxf patchelf-0.18.0.tar.gz -C /usr/local/src/ cd /usr/local/src/patchelf-0.18.0 CFLAGS="-fPIC -O3" ./configure make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install cd -
下面就可以进行MySQL的编译安装。