我要评分
获取效率
正确性
完整性
易理解

CMake Command Execution Failure During MySQL Compilation and Installation

Symptom

During MySQL compilation and installation, the message shown in Figure 1 is displayed after you run the following command:

1
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -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.27/boost/boost_1_59_0
Figure 1 CMake error message

Key Process and Cause Analysis

CMake has been executed in the root directory of the code, and CmakeCache.txt has been generated in the root directory. As a result, the preceding message is displayed during MySQL compilation and installation.

Conclusion and Solution

Delete CmakeCache.txt and perform compilation again.

  1. Go to the /home/mysql-5.7.27 directory and delete the cmakeCache.txt file.
    cd /home/mysql-5.7.27
    rm cmakeCache.txt
  2. Run the following cmake command:
    1
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -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.27/boost/boost_1_59_0