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

Preparing a MySQL Build Script

Use a script to configure compilation options for application building. The script contains MySQL compilation and installation commands.

To create a build script, perform the following steps:

  1. Create a script file.
    1
    vi /root/build.sh
    
  2. Press i to enter the insert mode and add the following contents to the file:
    1
    2
    3
    4
    5
    6
    cd /root/mysql-8.0.25/ # /root/mysql-8.0.25/ is the MySQL source code path. Change the path to the actual one.
    rm -rf build
    mkdir build && cd build
    cmake .. -DBUILD_CONFIG=mysql_release -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-gcc -DWITH_BOOST=../boost/  # /usr/local/mysql-gcc is the path to MySQL to be compiled and installed with FDO enabled. When compiling MySQL 5.7, add the -DENABLE_DTRACE=off parameter.
    make -j 96 VERBOSE=1
    make install
    

    In the command, -j 96 can make full use of the multi-core feature of the CPUs to accelerate the compilation. The number following -j indicates the number of CPU cores. You can run the cat /proc/cpuinfo | grep processor | wc -l command to query the number of CPU cores. The value specified must be less than or equal to the actual number of CPU cores.

  3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.