1 Downloads
1.1 Download URL: www.mysql.com
1.2 Download method
1.2.1 Enter the homepage, select DOWNLOADS , and we are in the download page. As shown in the download URL https://www.mysql.com/downloads/
1.2.2 Go to the download page, you can see a lot of products, here we pull the scroll bar to the bottom. What we want to download is MySQL Community Edition (GPL)
1.2.3 after entering MySQL community. Selecting operating System Select Source Code; version according to everyone's needs, here we choose Generic Linux.
1.2.4 Here we see there are two resource for us to download. Download includes Boost Headersis recommended here.
Note:boost is an extension of the C + + development Library, designed to standardize the C + + library for cross-platform use. Here we mainly compile MySQL code with it.
2 compiling
2.1 Decompression
TAR-ZXVF mysql-boost-5.7.18.tar.gz
2.2 Compiling
2.2.1 Creating a compilation project
CD MYSQL-5.7.18-SRC
mkdir BLD
CMake. -ddownload_boost=0-dwith_boost=. /boost/-dmysql_datadir=/mysqldb/mysql-5.7.18/data
Note1:cmake-(cross platform make) is a platform-based compilation tool that is used primarily to generate makefile or project files. Only the CMake configuration file is named CMakeLists.txt.
Note2:cmake in compiling MySQL has a lot of option and can be viewed by MySQL official.
2.2.2 Compiling
Make
3 Installation
3.1 Make Install
Note: Since we did not specify the installation directory for MySQL when we generated project CMake, you can view the MySQL installation directory after the installation is complete.
4 initialization
cd/mysqldb/mysql-5.7.18
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db --user=mysql# before MySQL 5.7.6
bin/mysqld --initialize --user=mysql# MySQL 5.7.6 and up
Note: After initialization is complete, MySQL will create an initialized password for [email protected].
5 Start
bin/mysqld_safe--user=mysql &
This article from "12398798" blog, declined reprint!
MySQL 5.7.18 Source Code Installation