Objective
MySQL is a relational database management system, is the most popular relational database management system, because of its small size, fast, low total cost of ownership, and was completely open source, so popular. But since MySQL was sold to Sun, then Sun was acquired by Oracle, and although there is also a free version of open source, many features require a separate commercial version, resulting in a gradual decrease in MySQL usage today. So Mariadb was born for this reason, become a database management system is a branch of MySQL.
You have previously installed mariadb with binary (see http://www.178linux.com/8787 for details), and the following describes how to use the source package to compile and install MARIADB 10.
Source Code Compilation Installation MARIADB
First, the installation needs to pay attention to the place
MySQL since 5.5, including, compile and install Project code management is not using make, but using CMake. So we're going to compile and install MARIADB, the first step is to prepare the development environment and install CMake (CMake is not installed by default)
Second, pre-compilation preparation work
2.1. Copy the mariadb-10.0.12.tar.gz to the server
2.2. Install the Development library
[Email protected] yum.repos.d]# yum-y groupinstall Development tools
2.3, ready to Epel Yum source
[Email protected] ~]# vim/etc/yum.repos.d/epel.repo[epel]name=epelmirrorlist=http://mirrors.fedoraproject.org/ mirrorlist?repo=epel-$releasever &arch= $basearchenabled =1gpgcheck=0
Third, prepare to rely on the library and related packages
3.1. Install Judy Development Library (Judy-devel)
Note: Compiling one of the oqgraph needs to rely on this development package, installing Judy-devel's Yum source is using Epel source, so first configure the Epel source
[email protected] mariadb-10.0.12]# Yum install Judy-devel–y
3.2, Installation CMake
[email protected] yum.repos.d]# Yum install cmake-y
3.3. Install ncurses Development Kit
[email protected] mariadb-10.0.12]# Yum install Ncurses-devel–y
3.4. Install LIBXML2 Development Kit
Subsequent compilations require the use of
[email protected] mariadb-10.0.12]# Yum install libxml2-devel-y
3.5. Install Boost Development Package
[email protected] ~]# Yum install Boost-devel–y
3.6, installation Openssl-devel
[email protected] ~]# Yum install Openssl-devel
Iv. preparation of MARIADB before compiling
4.1, decompression mariadb-10.0.12
[Email protected] ~]# Tar XF mariadb-10.0.12.tar.gz
4.2. Add Users
[[email protected] ~]# useradd-r MySQL
4.3. Create Data Catalog
[Email protected] ~]# mkdir/mydata/data–pv[[email protected] ~]# chown-r mysql.mysql/mydata/data/
4.4. View the Help document
[Email protected] ~]# CD Mariadb-10.0.12[[email protected] mariadb-10.0.12]# cmake. -lh
V. Compile and install MARIADB
5.1, compile and install, and specify the corresponding parameter settings
[Email protected] ~]# CD Mariadb-10.0.12[[email protected] mariadb-10.0.12]# Cmake-dboost_no_boost_cmake=true[[email Protected] mariadb-10.0.12]# CMake. -dmysql_datadir=/mydata/data-dwith_ssl=system-dwith_sphinx_storage_engine=1#-DMYSQL_DATADIR=/mydata/data Specify Data directory path #-DWITH_SSL=SYSTEM specifies support for SSL connection #-dwith_sphinx_storage_engine=1 specifies support for SPHINX storage engine
[[email protected] mariadb-10.0.12]# Make[[email protected] mariadb-10.0.12]# make install
Note If the pre-compilation dependency library or the development library is not installed, install it first, then remove the installation package and re-unzip the compilation operation.
5.2. Create a Build service file
[[email protected] mariadb-10.0.12]# Cd/usr/local/mysql/[[email protected] mysql]# CP support-files/mysql.server/etc/ Rc.d/init.d/mysqld[[email protected] mysql]# chmod +x/etc/rc.d/init.d/mysqld
5.3. Copy and modify the service configuration file
[email protected] mysql]# cp support-files/my-large.cnf/etc/my.cnfcp:overwrite '/etc/my.cnf '? Y[[email protected] mysql]# vim/etc/my.cnf[mysqld] #在此组字段下添加datadir =/mydata/data
5.4. Initialize MySQL
[Email protected] mysql]# pwd/usr/local/mysql[[email protected] mysql]# scripts/mysql_install_db--user=mysql-- Datadir=/mydata/data
Vi. mariadb Setup after installation is complete
6.1, start the service
[[Email protected] mysql]# service mysqld start
6.2, set the boot automatically start
[Email protected] ~]# chkconfig mysqld on
6.3. Add the MySQL command to the PATH variable
[Email protected] ~]# vim/etc/profile.d/mysql.shexport path=/usr/local/mysql/bin: $PATH
6.4, let the contents of the file configuration can be effective
[Email protected] ~]#. /etc/profile.d/mysql.sh
Vii. Use of client testing
[[email protected] local]#/usr/local/mysql/bin/mysqlmariadb [(none)]> SHOW ENGINES; #查看支持的存储引擎
Note: If you have not previously added the MySQL command to the path variable, you can use Usr/local/mysql/bin/mysql to open the MySQL command
This is the source package compiled installation MARIADB completed.
Summary of issues that have occurred while compiling the installation
1, the implementation of CMake, the prompt "CMake Error_c_compiler", the following is a partial error message
CMake Error:cmake was unable to find a build program corresponding to "Unix makefiles". Cmake_make_program is not set. You probably need to select a different build tool. CMake Error:error Required Internal CMake variable not set, CMake May is not being built correctly.
Workaround
Installing Development tools Development tools
[email protected] mariadb-10.0.12]# yum Groupinstall "Development tools"
2, compile error, reported "CMake error at Cmake/ssl.cmake" Below is a partial error message
CMake Error at cmake/ssl.cmake:162 (file): File STRINGS file "/root/mariadb-10.0.12/openssl_include_dir-notfound/ Openssl/opensslv.h "cannot be read.
Workaround
This is because we have a file that we need to delete, delete the current directory under the CMakeCache.txt file and recompile it, and run the CMake command again cmake.
[[email protected] mariadb-10.0.12]# rm-f cmakecache.txt[[email protected] mariadb-10.0.12]# Yum install ncurses-devel– Y
3, compile times wrong "Could not find Boost", the following is a partial error message
--Configuring oqgraph--Could not the Find boost--Boost not found. Oqgraph won't be compiled
Workaround
Install the Boost development kit to
[email protected] ~]# Yum install boost-devel-y
4, compile times wrong "CMake error At/usr/lib64/boost/boost.cmake", the following is a partial error message
CMake Error at/usr/lib64/boost/boost.cmake:536 (message): The imported target "boost_date_time-static" references the fi Le "/usr/lib64/lib64/libboost_date_time.a" but the this file does not exist. Possible reasons include:
Solutions
Execute the following command under the MARIADB directory
[[email protected] mariadb-10.0.12] #cmake-dboost_no_boost_cmake=true
5, at compile time appears "Could not find LIBXML2", the following is partial error information
--CONNECT:GCC:Some warnings disabled--Could not find LIBXML2 (missing:libxml2_libraries libxml2_include_dir)
Solutions
Installing the Libxml2-devel Development Kit
[email protected] mariadb-10.0.12]# Yum install Libxml2-devel
6, compile installation Error "Judy not found. Oqgraph won't be compiled "
Solutions
#首先先添加epel源 [[email protected] ~]# vim/etc/yum.repos.d/epel.repo[epel]name=epelmirrorlist=http:// mirrors.fedoraproject.org/mirrorlist?repo=epel-$releasever &arch= $basearchenabled =1gpgcheck=0# Install judy-devel Development Kit [[email protected] mariadb-10.0.12]# Yum install Judy-devel
This article is from the "Crab Learn Linux" blog, please be sure to keep this source http://windchasereric.blog.51cto.com/5419433/1743381
Source Package Compilation Installation MARIADB