Debian 下mysql编译更新


下载最新版

cd ~/mysql_source
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.44.tar.gz
tar -xzf mysql-5.7.44.tar.gz
cd mysql-5.7.44

编译时出现boost找不到的情况,需要手动下载

 LOCAL_BOOST_DIR
-- LOCAL_BOOST_ZIP
-- Could not find (the correct version of) boost.
-- MySQL currently requires boost_1_59_0

CMake Error at cmake/boost.cmake:88 (MESSAGE):
  You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>

  This CMake script will look for boost in <directory>.  If it is not there,
  it will download and unpack it (in that directory) for you.

解决办法:

在编译 MySQL 5.7 的过程中,CMake 需要指定正确的 Boost 库版本(boost_1_59_0)。你遇到的错误提示 MySQL 需要 Boost 1.59.0 版本。以下是解决该问题的步骤:

手动下载并指定 Boost 目录

如果你更倾向于手动下载 Boost,可以按照以下步骤操作:

  1. 下载 Boost 1.59.0

前往 Boost 官方网站或使用以下命令下载 Boost 1.59.0:

cd ~/
wget https://boostorg.jfrog.io/artifactory/main/release/1.59.0/source/boost_1_59_0.tar.gz
  1. 解压 Boost

解压下载的 Boost 压缩包:

tar -xzf boost_1_59_0.tar.gz
  1. 指定 Boost 路径

cmake 命令中指定 WITH_BOOST 参数为解压的 Boost 目录路径,例如:

cmake .. -DWITH_BOOST=/homes/ming/boost_1_59_0

总结

无论选择哪种方式,确保 CMake 能够找到所需的 Boost 库。成功配置后,你可以继续进行 MySQL 的编译和安装。

编译安装mysql,这里安装到/usr/local/mysql/

cd ~/mysql_source/mysql-5.7.44/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_SSL=system -DWITH_ZLIB=system -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/homes/ming/boost_1_59_0
make
sudo make install

配置

sudo service mysql.server stop
sudo mv /etc/init.d/mysql /etc/init.d/mysql_bak
sudo cp support-files/mysql.server /etc/init.d/mysql.server

将新安装的mysql bin 复制到系统环境

cd /usr/local/mysql/bin/
ls | xargs -I{} sudo rm /usr/bin/{}
ls | xargs -I{} sudo cp {} /usr/bin/{}
sudo ln -s mysqld /sbin/
sudo service mysql.server start
Ming Su
Ming Su
Associate Professor of Environmental Engneering

My research interest is water quality problems in drinking water bodies, with a focus on harmful algal blooms and associated taste & odor problems.