MySQL is an open-source database, so it can be installed based on the source code. Source code-based installation provides more flexibility. That is to say, we can choose the appropriate Compilation Method for our hardware platform.
MySQL is an open-source database, so it can be installed based on the source code. Source code-based installation provides more flexibility. That is to say, we can choose the appropriate Compilation Method for our hardware platform.
MySQL is an open-source database, so it can be installed based on the source code. Source code-based installation provides more flexibility. That is to say, we can select a suitable compiler for our hardware platform to optimize the compiled binary code and adjust the relevant compilation parameters according to the environment of different software platforms, select different installation components and set the desired character set. You can make various adjustments based on specific application scenarios. This article describes how to install MySQL in the source code mode.
1. installation environment and media
# Installation environment
SZDB :~ # Cat/etc/issue
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64)-Kernel \ r (\ l ).
SZDB :~ # Uname-
Linux SZDB 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux
# Install media. You can download the installation media at the following URL. Select source code when downloading. The current version is 5.6.17.
# Download the corresponding installation media according to your own environment, the installation media demonstrated in this article is Generic Linux (Architecture Independent), mysql-5.6.17.tar.gz
# Link to the official website for source code installation:
2. System Requirements
Source Installation System Requirements
Installation of MySQL from source requires several development tools. some of these tools are needed no matter whether you use a standard source distribution or a development source tree. other tool requirements depend on which installation method you use.
To install MySQL from source, your system must have the following tools, regardless of installation method:
CMake, which is used as the build framework on all platforms. CMake can be downloaded from
A good make program. although some platforms come with their own make implementations, it is highly recommended that you use GNU make 3.75 or newer. it may already be available on your system as gmake. GNU make is available from
A working ansi c ++ compiler. GCC 4.2.1 or later, Sun Studio 12 or later, Visual Studio 2010 or later, and merge current vendor-supplied compilers are known to work.
Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl.
# Install the above development tools using the source code. The most important one is the Cmake tool. Generally, the OS is not installed and must be manually installed.
# If no cmake is available, this error message is displayed: (-bash: cmake: command not found)
3. Install cmake
# You can download cmake here. Here I download version 2.6.4.
SZDB :~ # Cd/usr/local/src/mysql_src
SZDB:/usr/local/src/mysql_src # tar-xvf cmake-2.6.4.tar.gz
SZDB:/usr/local/src/mysql_src # cd cmake-2.6.4
SZDB: // usr/local/src/mysql_src/cmake-2.6.4 #./bootstrap
SZDB:/usr/local/src/mysql_src/cmake-2.6.4 #./make
SZDB:/usr/local/src/mysql_src/cmake-2.6.4 #./make install
4. Install MySQL
SZDB :~ # Groupadd mysql
SZDB :~ # Useradd-r-g mysql
SZDB :~ # Cd/usr/local/src/mysql_src
SZDB:/usr/local/src/mysql_src # tar-xvf mysql-5.6.17.tar.gz
SZDB:/usr/local/src/mysql_src # ls
Mysql-5.6.17 mysql-5.6.17.tar.gz
SZDB:/usr/local/src/mysql_src # mysql-5.6.17/cd/
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # cmake.
..........
-- Check size of wint_t-done
-- Cocould NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline. cmake: 85 (MESSAGE): Author: Leshami
Curses library not found. Please install appropriate package, Blog:
Remove CMakeCache.txt and rerun cmake. On Debian/Ubuntu, package name is libncurses5-dev,
On RedHat and derivates it is ncurses-devel.
Call Stack (most recent call first ):
Cmake/readline. cmake: 128 (FIND_CURSES)
Cmake/readline. cmake: 202 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt: 411 (MYSQL_CHECK_EDITLINE)
# If the above error occurs during cmake, install the ncurses-devel rpmpackage and remove cmakecache.txt.
-- Refreshing incomplete, errors occurred!
# If there is any corresponding OS installation CD, you can download this rpm package from the following link. Note that the corresponding version number should be consistent.
SZDB:/usr/local/src/mysql_src # rpm-Uvh ncurses-devel-5.5-18.11.x86_64.rpm
Preparing... ######################################## ### [100%]
1: ncurses-devel ##################################### ###### [100%]
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # rm-rf CMakeCache.txt
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # cmake. # execute cmake again
........
-- Library mysqlserver depends on OSLIBS-lpthread; m; rt; crypt; dl; aio
-- Processing ing done
-- Generating done
-- Build files have been written to:/usr/local/src/mysql_src/mysql-5.6.17
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # make
Linking CXX executable mysqltest_embedded
[1, 100%] Built target mysqltest_embed
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
[1, 100%] Built target my_safe_process