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:
- Create a script file.
1vi /root/build.sh - 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.
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
Parent topic: Automatic FDO