Best practices for source code compilation and installation of MySQL5.6.10

Source: Internet
Author: User
1. Install cmakeMySQL from Version 5.5 and use. configure for compilation and configuration has been canceled. Instead, it is replaced by the cmake tool. Therefore, we must first compile and install the cmake tool in the system source code. Unzip wget#tarzxvfcmake-2.8.7.tar.gz # cdcmake-2.8.7 #. configure # make # makeinstall1.1

1. Install cmake MySQL from Version 5.5 and use./configure for compilation and configuration has been canceled. Instead, use the cmake tool. Therefore, we must first compile and install the cmake tool in the system source code. # Wget # tar zxvf cmake-2.8.7.tar.gz # cd cmake-2.8.7 #./configure # make install 1.1

1. Install cmake

MySQL 5.5 and later versions have been replaced by the cmake tool./configure compilation and configuration method.

Therefore, we must first compile and install the cmake tool in the system source code.

# Wget

# Tar zxvf cmake-2.8.7.tar.gz

# Cd cmake-2.8.7

#./Configure

# Make

# Make install

1.1cmake command syntax

1.2 during re-compilation, the old object files and cache information must be cleared.

# Make clean

# Rm-f CMakeCache.txt

1.3 Installation Options

The CMAKE_INSTALL_PREFIX value is the basic directory for installation. Other cmake option values do not include the prefix or relative path name. The absolute path includes the CMAKE_INSTALL_PREFIX path. For example, the absolute path of-DINSTALL_SBINDIR = sbin is/usr/local/mysql/sbin.

1.4 storage engine options

The mysql storage engine is plug-in-type, so the plug-in control option can specify the storage engine for installation.

Configure compilation plug-in options -- with-plugins = csv, myisam, myisammrg, heap, innobase, archive, and blackhole do not directly correspond to the same options in cmake. For csv, myisam, myisammrg, and heap, you do not need to specify the name of the storage engine in cmake because they are mandatory for installation.

You can use the following options to install the innodb, archive, and blackhole storage engines.

-DWITH_INNOBASE_STORAGE_ENGINE = 1

-DWITH_ARCHIVE_STORAGE_ENGINE = 1

-DWITH_BLACKHOLE_STORAGE_ENGINE = 1

(1 can be replaced by on)

If you do not specify the storage engine either-dwith1_storage_engine or-dwithout1_storage_engine, the storage engine will be installed as a shared modular storage engine. If it is not shared modular, it will be excluded. You must use the install plugin statement or -- plugin-load to INSTALL the shared module.

For more information about CMake options of the plug-in, refer:

1.5 lib library options

1.6 other options

In the past, most MySQL compilation options were supported. The installation options of the new and old versions are mapped to uppercase letters, and the front dashes of the delete option are replaced with underscores. For example:

-- With-debug => WITH_DEBUG = 1

-- With-embedded-server => WITH_EMBEDDED_SERVER

1.7 configuration debugging

After the configure is compiled, the config. log and config. status files are generated.

After cmake is compiled, the CMakeError. log and CMakeOutput. log files are generated in the CMakeFiles directory.

1.8 third-party interface tools

In earlier versions, a third-party tool reads the source configure. in file from the MySQL top-level Source directory to determine the mysql version. For example, the AC_INIT line of version 5.5.7-RC looks like this:

AC_INIT ([MySQLServer], [5.5.7-rc], [], [mysql])

The current version can directly read the version file. For example, if the version is 5.5.8, the file looks like this:

MYSQL_VERSION_MAJOR = 5

MYSQL_VERSION_MINOR = 5

MYSQL_VERSION_PATCH = 8

MYSQL_VERSION_EXTRA = rc

If the source package is not GA, the value of MYSQL_VERSION_EXTRA is not empty. For example, for an RC version, the following is true: MYSQL_VERSION_EXTRA = rc.

Build the version number of the five-digit number using the following formula:

MYSQL_VERSION_MAJOR * 10000 + MYSQL_VERSION_MINOR * 100 + MYSQL_VERSION_PATCH

2. Verify the installation dependency

Run the rpm-qa | grep name command to verify whether all of the following software packages have been installed.

Gcc * gcc-c ++ * autoconf * automake * zlib * libxml * ncurses-devel * libmcrypt * libtool *

Yum installation example

Example: yum install gcc-c ++

Example: yum install ncurses-devel

If the related software package is missing, you can install it online using yum-y install, or find it directly from the system installation disc and install it using rpm-ivh.

3. system settings before installation

Create the mysql installation directory and data storage directory

# Mkdir/usr/mysql5.5

# Mkdir/usr/mysql5.5/data

Create users and user groups

# Groupadd mysql

# Useradd-gmysql mysql

Grant the data storage directory permission

# Chown mysql: mysql-R/opt/mysql5.5/data

4. Start installation (replace configure with cmake)

I believe that most people are used to the configure method and the parameters used are more personalized. After changing to cmake, this will cause a lot of trouble.

Fortunately, the MySQL official website provides a parameter comparison table between the two. We can keep the previous parameters as much as possible to compile and configure the new MySQL version.

Configure and cmake parameters:

  

Take myself as an example. The parameters that I used previously are:

./Configure -- prefix =/opt/mysql/

-- Sysconfdir =/opt/mysql/etc

-- Localstatedir =/opt/mysql/data

-- With-tcp-port = 3306

-- With-unix-socket-path =/tmp/mysqld. sock

-- With-mysqld-user = mysql

-- Enable-aggreger

-- With-extra-charsets = all

-- Enable-thread-safe-client

-- With-big-tables

-- With-readline

-- With-ssl

-- With-embedded-server

-- Enable-local-infile

-- With-plugins = partition, innobase, myisammrg

After comparison with cmake parameters, remove the canceled parameters (most of which are enabled by default in the new version). The cmake parameter configuration is as follows:

Cmake-DCMAKE_INSTALL_PREFIX =/opt/mysql

-DSYSCONFDIR =/opt/mysql/etc

-DMYSQL_DATADIR =/opt/mysql/data

-DMYSQL_TCP_PORT = 3306

-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock

-DMYSQL_USER = mysql

-DEXTRA_CHARSETS = all

-DWITH_READLINE = 1

-DWITH_SSL = system

-DWITH_EMBEDDED_SERVER = 1

-DENABLED_LOCAL_INFILE = 1

-DWITH_INNOBASE_STORAGE_ENGINE = 1

-DWITHOUT_PARTITION_STORAGE_ENGINE = 1

Without line breaks (only one line)

4.1 parameter:-DWITHOUT_PARTITION_STORAGE_ENGINE = 1

The following error occurs when compilation fails on a 64-bit machine: (if an error occurs during Floating Point Calculation on a 64-bit machine, the corresponding function cannot be found)

Libsql. a (handler. cc. o): In function 'get _ ha_partition (partition_info *)':

/Data/mysql-5.5.14/SQL/handler. cc: 269: undefined reference to 'Ha _ partition: ha_partition (handlerton *, partition_info *)'

/Data/mysql-5.5.14/SQL/handler. cc: 271: undefined reference to 'Ha _ partition: initialize_partition (st_mem_root *)'

Libsql. a (SQL _partition_admin.cc.o): In function 'alter _ table_truncate_partition_statement: execute (THD *)':

/Data/mysql-5.5.14/SQL/SQL _partition_admin.cc: 165: undefinedreference to 'Ha _ partition: truncate_partition (Alter_info *, bool *)'

Collect2: ld returned 1 exit status

Make [2]: *** [SQL/mysqld] Error 1

Make [1]: *** [SQL/CMakeFiles/mysqld. dir/all] Error 2

Make: *** [all] Error 2

4.2 parameter:-DWITH_SSL = bundled

This parameter must be included by default in MySQL 5.6. * and later versions. Otherwise, the compilation will fail. related posts:

Https://github.com/santisaez/powerstack/issues/49

Use bundled SSL on CentOS-5.

4.3 installation and execution

# Tar xvf mysql-5.5.10.tar.gz

# Cd mysql-5.5.10

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.