Mysql source code Compilation Tutorial Stickers

Source: Internet
Author: User
Tags mysql download

Digression: This is a tutorial paste, not only to learn the MySQL compilation, or some compilation of knowledge. I am also a rookie, write some sentiment and experience, what problems can be criticized, thank you!

If it's just for installation please move to my other post installation sticker: MySQL installation sticker

Environment:
Os:centos 6.6x64 Mini
mysql:mysql-5.6.25
1. mysql Download:
http://dev.mysql.com/downloads/mysql/
Description: This site sometimes JS by the wall, you choose the source code will not respond, so you can consider to turn over to turn over the Q or directly click the link below
: http://101.44.1.118/files/90110000038859AB/nchc.dl.sourceforge.net/project/mysql.mirror/MySQL%205.6.25/ Mysql-5.6.25.tar.gz

2. Installation:

☆ Ban off Selinx

★ Use the command below to obtain SELinux:

[Email protected] ~]# getenforce Disabled

Disabled has been disabled, you can skip this step.

Enforcing Open state

Permissive temporarily disabled

★ Use the following command to disable SELinux (the first one is temporarily disabled and the second one is permanently disabled)

0sed's/selinux=enforcing/selinux=disabled/' /etc/selinux/ Config

★ Check whether the correct changes

[Email protected] ~cat /etc/selinux/config

Confirm that the selinux=disabled (SELINUX configuration file must be correct, if the wrong system will not start properly.)

☆ Create MySQL Account

-G MySQL MySQL

☆ Dependent Package

Yum Install wget  gcc -y

Cmake: Because MySQL 5.6 supports Cmake installation, we use Cmake installation.

wget is the Linux download tool, below is the download MySQL source package (download to the current directory)

wget http://101.44.1.118/files/90110000038859ab/nchc.dl.sourceforge.net/project/ Mysql.mirror/mysql%205.6.25/mysql-5.6.25.tar.gz

☆ Unzip the MySQL source package and go to unzip directory

tar xvf  mysql-5.6.  . Tar  ~]# CD mysql-5.6.  -

☆ Configuration

CMake-dcmake_install_prefix=/usr/local/MySQL-dmysql_datadir=/usr/local/mysql/Data-dsysconfdir=/etc-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_readline=1 -dmysql_unix_addr=/var/lib/mysql/Mysql.sock-dmysql_tcp_port=3306 -denabled_local_infile=1 -dwith_partition_storage_engine=1 -dextra_charsets= All-ddefault_charset=UTF8-ddefault_collation=utf8_general_ci

-dcmake_install_prefix= point to MySQL installation directory (where installed)

-dmysql_datadir= MySQL Data Catalog

-dsysconfdir= MySQL configuration file (where to put the configuration file)

Here the configuration will be wrong, please go back to the nonsense section, take you to take you to fly.

          

☆ Compile and install (the process is long, wait patiently)

 Make  Make Install

In the group found a lot of people in the compile time error, and the configuration is not sure whether the operation is successful. Although I have some explanations, I would like to mention that there is a $?.. under Linux. The execution is done. Uncertainty followed by execution: Echo $?

If return 0 indicates that the previous command executed successfully, any number other than 0 represents an error.

☆ Configure MySQL

★ Go to MySQL's installation directory

[[Email protected] ~] #cd/usr/local/mysql

★ Set Permissions

chown -R MySQL. chgrp -R MySQL.

★ Initialize Database

scripts/mysql_install_db--user=mysql

★ Set Permissions

chown -R root. chown -R MySQL Data

★ Start Database

Bin/mysqld_safe--user=mysql &

Many friends would say to write a MySQL startup script, why write their own, MySQL has provided:

CP Support-files/mysql.server/etc/init.d/mysql.server

This will allow the service MySQL start

3. Nonsense article:

tutorial, you have to have nonsense ... Nonsense start:

The installation of the source code is compiled here, the configuration is compiled, what is configured? How to configure? How to get it, the best way to do it is official documentation, and the configuration is to extend some features The official documentation has an explanation of the role of each configuration item and whether it is configured by default. There is a install-source.txt in the source package. Written in very detailed there are thousands of lines in 5,000 lines where <2.9 installing MySQL from Source > have said how to install ...

Configuration is configuration, compile is compile. installation is installation. Configuration is used by the CMake, compile is make. installation is make install. To ensure that each step is successful, proceed to next step, how to confirm? Look at the tip of the configuration end, or the configuration ends immediately after the input echo $? If returning 0 indicates that the operation was successful, nonzero is a problem.

Compilation does not necessarily guarantee that 100% is not a problem, the tutorial is to teach you how to compile, say some of their own experience. Other mistakes have to be experienced and there is no way to list the whole mistake.

If you follow the steps I've done, I'm sure the compilation will go wrong:

Part of the error message:

CMake error:your C Compiler: "Cmake_c_compiler-notfound" is not found. Please set Cmake_c_compiler to a valid COMPILER path or name.

CMake error:your CXX Compiler: "Cmake_cxx_compiler-notfound" was not found. Please set Cmake_cxx_compiler to a valid COMPILER path or name.

Actually look out is C's question, C is why? This will increase their knowledge reserves, if not sure to copy Baidu under, more look at the solution:

Yum Install gcc -y

Again (to execute CMake), the second cxx found the error is not resolved. That's the C + + problem.

Yum Install gcc-c++

Again, and found that the top mistake was gone, but there was a new mistake.

Keyword: no suitable type found Baidu Baidu

Yum Install Ncurses-devel

The problem did not resolve, and later found to be deleted CMakeCache.txt giant Khan ...

RM-RF CMakeCache.txt

Re-executing the cmake command

Compile slowly, etc...

There are many found in the middle, not found

This means that some dependencies have been found, and some dependencies have not been found. If there is no error description is not fatal errors, you can later some features are not installed (not installed on how not to do it?) reconfigure the build installation plus the features you need to install what you need to see official documents, or find them online.

Next compile:

Make

Installation:

 Make Install

Make sure the execution succeeds, return to configure MySQL, and then configure MySQL

Okay, here we go, there's something wrong, there's a problem to be raised ...

By the way posted on the Internet to find the explanation of configuration items:

  

-dcmake_install_prefix= pointing to the MySQL installation directory
-dinstall_sbindir=sbin pointing to the executable directory (Prefix/sbin)
-dmysql_datadir=/var/lib/mysql pointing to the MySQL data Files directory (/VAR/LIB/MYSQL)
-dsysconfdir=/etc/mysql pointing to the MySQL configuration file directory (/ETC/MYSQL)
-dinstall_plugindir=lib/mysql/plugin pointing to the plug-in directory (Prefix/lib/mysql/plugin)
-dinstall_mandir=share/man pointing to the Man document directory (Prefix/share/man)
-dinstall_sharedir=share point to ACLOCAL/MYSQL.M4 installation directory (Prefix/share)
-dinstall_libdir=lib/mysql pointing to the object code base directory (PREFIX/LIB/MYSQL)
-dinstall_includedir=include/mysql pointing to the header file directory (prefix/include/mysql)
-dinstall_infodir=share/info point to Info document storage directory (Prefix/share/info)
Prefix official recommendation to/USR
Storage Engine Related
Type Csv,myisam,myisammrg,heap,innobase,archive,blackhole
To enable support for an engine:-dwith_<engine>_storage_engine=1
Such as:
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
To disable support for an engine:-dwithout_<engine>_storage_engine=1
Such as:
-dwithout_example_storage_engine=1
-dwithout_federated_storage_engine=1
-dwithout_partition_storage_engine=1
Library related
-dwith_readline=1 Enable READLINE Library Support (provides editable command line)
-dwith_ssl=system Enable SSL library support (Secure Sockets Layer)
-dwith_zlib=system Enable LIBZ library Support (Zib, Gzib related)
-dwtih_libwrap=0 Disabling the LibWrap library (implements the functionality of the generic TCP wrapper for use by the Network Service daemon)
-DMYSQL_TCP_PORT=3306 specifies that the TCP port is 3306
-dmysql_unix_addr=/tmp/mysqld.sock Specifying Mysql.sock Path
-denabled_local_infile=1 enable local data import support
-dextra_charsets=all enable additional character set types (default to All)
-DDEFAULT_CHARSET=UTF8 specifies that the default character set is UTF8
-ddefault_collation=utf8_general_ci Set Default collation (Utf8_general_ci Fast/utf8_unicode_ci accurate)
-dwith_embedded_server=1 Compiling embedded Server support
-dmysql_user=mysql specifying MySQL User (default is MySQL)
-dwith_debug=0 Disable DEBUG (default is disabled)
-denable_profiling=0 Disabling PROFILING analysis (enabled by default)
-dwith_comment= ' String ' A descriptive comment about the compilation environment

Mysql source code Compilation Tutorial Stickers

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.