51ak shows you MYSQL5.7 source code 2: compile existing code, 51akmysql5.7
Have worked as a DBA for many years
MYSQL source code is also the first contact
Try to record the process of viewing the MYSQL5.7 source code by yourself
Directory:
51ak: MYSQL5.7 source code 1: main Entry Function
51ak shows you MYSQL5.7 source code 2: compile existing code
Now install the source code in VSCODE as a service.
Testing Machine: CENTOS6 (Virtual Machine is configured as 4c + 4g ),
Install related components in YUM
Yum-y install gcc-c ++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool bison
After execution, check whether the existing BOOTST version is deleted.
root@wjz-3-227 ~]# rpm -qa boost*boost-filesystem-1.41.0-18.el6.x86_64boost-system-1.41.0-18.el6.x86_64[root@wjz-3-227 ~]# yum -y remove boost-*Loaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessResolving Dependencies--> Running transaction check
Upload the edited files to the test machine and put them in the/work directory.
Copy and install BOOST
root@wjz-3-227 mysql-server]# lltotal 108drwxr-xr-x. 8 root root 4096 Mar 22 2018 boost_1_59_0-rw-r--r--. 1 root root 160 Dec 28 12:00 filter-provides.sh-rw-r--r--. 1 root root 176 Dec 28 12:00 filter-requires.shdrwxr-xr-x. 32 root root 4096 Mar 22 2018 mysql-5.1.72drwxr-xr-x. 35 root root 4096 Mar 22 2018 mysql-5.7.21-rw-r--r--. 1 root root 88859 Dec 28 12:00 mysql.spec[root@wjz-3-227 mysql-server]# cp -r boost_1_59_0 /usr/local/boost
Run the following script:
groupadd mysqlmkdir /home/mysqlmkdir /home/mysql/datauseradd mysql -g mysql -d /home/mysqlcd mysql-5.7.21/mkdir debugcd debug
Start MAKE
cmake .. \-DCMAKE_INSTALL_PREFIX=/home/mysql \-DMYSQL_DATADIR=/home/mysql/data \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DMYSQL_TCP_PORT=3306 \-DMYSQL_USER=mysql \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_ARCHIVE_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DDOWNLOAD_BOOST=1 \-DWITH_BOOST=/usr/local/boost
If yes, the operation is successful.
Make-j 4
Long wait, compilation successful (testing machine performance too many times)
The following installation and initialization:
Make install make clean rm-f CMakeCache.txt cd/home/mysqlchown-R mysql: mysql. ll bin/mysqld -- initialize -- user = mysql -- basedir =/home/mysql -- datadir =/home/mysql/data # Remember the generated password in this step, use ll data/vim/etc/my later. cnf vim mysql. server cp mysql. server/etc/init. d/mysqld3306chmod 755/etc/init. d/mysqld3306 cd .. llservice mysqld3306 startbin/mysql-h127.0.0.1-uroot-p
So far