MySQL 5.7.9 source code compilation and installation instructions

Source: Internet
Author: User

MySQL 5.7.9 source code compilation and installation instructions

I. Environment Description

1. Operating System

System Version: RHEL 6.3X64

Operating system installation type: Basic

System installation package: gcc-c ++ bzip2 (default) bzip2-devel bzip2-libs (default) python-devel ncurses-devel bison

1) gcc-c ++

[Root @ mdb01 Packages] # rpm-ivh kernel-headers-2.6.32-279.el6.x86_64.rpm

Warning: kernel-headers-2.6.32-279.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: kernel-headers ##################################### ###### [100%]

[Root @ mdb01 Packages] # rpm-ivh glibc-headers-2.12-1.80.el6.x86_64.rpm

Warning: glibc-headers-2.12-1.80.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: glibc-headers ##################################### ###### [100%]

[Root @ mdb01 Packages] # rpm-ivh glibc-devel-2.12-1.80.el6.x86_64.rpm

Warning: glibc-devel-2.12-1.80.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: glibc-devel ##################################### ###### [100%]

[Root @ mdb01 Packages] # rpm-ivh mpfr-2.4.1-6.el6.x86_64.rpm

Warning: mpfr-2.4.1-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: mpfr ####################################### #### [100%]

[Root @ mdb01 Packages] # rpm-ivh cpp-4.4.6-4.el6.x86_64.rpm

Warning: cpp-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: cpp ####################################### #### [100%]

[Root @ mdb01 Packages] # rpm-ivh ppl-0.10.2-11.el6.x86_64.rpm

Warning: ppl-0.10.2-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: ppl ####################################### #### [100%]

[Root @ mdb01 Packages] # rpm-ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm

Warning: cloog-ppl-0.15.7-1.2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: cloog-ppl ##################################### ###### [100%]

[Root @ mdb01 Packages] # rpm-ivh gcc-4.4.6-4.el6.x86_64.rpm

Warning: gcc-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: gcc ####################################### #### [100%]

[Root @ mdb01 Packages] # rpm-ivh libstdc ++-devel-4.4.6-4.el6.x86_64.rpm

Warning: libstdc + +-devel-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: libstdc ++-devel ################################### ####### [1, 100%]

[Root @ mdb01 Packages] # rpm-ivh gcc-c ++-4.4.6-4. el6.x86 _ 64.rpm

Warning: gcc-c ++-4.4.6-4. el6.x86 _ 64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: gcc-c ++ ################################### ####### [1, 100%]

2) bzip2-devel python-devel

 

[Root @ mdb01 Packages] # rpm-ivh bzip2-devel-1.0.5-7.el6_0.x86_64.rpm

Warning: bzip2-devel-1.0.5-7.el6_0.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: bzip2-devel ####################################### #### [100%]

[Root @ mdb01 Packages] # rpm-ivh python-devel-2.6.6-29.el6_2.2.x86_64.rpm

Warning: python-devel-2.6.6-29.el6_2.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: python-devel ##################################### ###### [100%]

[Root @ mdb01 Packages] #

 

Boost system package installation check

 

[Root @ mdb01 Packages] # rpm-q gcc-c ++ bzip2 bzip2-devel bzip2-libs python-devel

Gcc-4.4.6-4.el6.x86_64

Gcc-c ++-4.4.6-4. el6.x86 _ 64

Bzip2-1.0.5-7.el6_0.x86_64

Bzip2-devel-1.0.5-7.el6_0.x86_64

Bzip2-libs-1.0.5-7.el6_0.x86_64

Python-devel-2.6.6-29.el6_2.2.x86_64

[Root @ mdb01 Packages] #

2. cmake-3.3.2

 

#./Bootstrap

# Make

# Make install

 

3. boost_000059_0

1. Pre-compile configuration

[Root @ mdb01 boost_000059_0] #./bootstrap. sh

Building Boost. Build engine with toolset gcc... tools/build/src/engine/bin. linuxx86_64/b2

Detecting Python version... 2.6

Detecting Python root.../usr

Unicode/ICU support for Boost. Regex ?... Not found.

Generating Boost. Build configuration in project-config.jam...

 

Bootstrapping is done. To build, run:

 

./B2

To adjust configuration, edit 'project-config. jam '.

Further information:

 

-Command line help:

./B2 -- help

-Getting started guide:

Http://www.boost.org/more/getting_started/unix-variants.html

-Boost. Build documentation:

Http://www.boost.org/build/doc/html/index.html

 

[Root @ mdb01 boost_000059_0] #

2. Compile

[Root @ rhel6 boost_000059_0] #./b2

 

...........

...........

 

... On 1100th target...

Gcc. compile. c ++ bin. v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/wave_config_constant.o

Common. mkdir bin. v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer

Common. mkdir bin. v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex

Gcc. compile. c ++ bin. v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex/aq. o

Gcc. compile. c ++ bin. v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex/cpp_re.o

Gcc. archive bin. v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/libboost_wave.a

Common. copy stage/lib/libboost_wave.a

... Updated 1107 targets...

 

 

The Boost C ++ Libraries were successfully built! (Indicates that the compilation is successful)

 

The following directory shocould be added to compiler include paths:

 

/Home/soft/boost_000059_0

 

The following directory shocould be added to linker library paths:

 

/Home/soft/boost_000059_0/stage/lib

3. Install

[Root @ mdb01 boost_000059_0] #./b2 install

 

...........

...........

Common. copy/usr/local/lib/libboost_signals.so.1.59.0

Ln-UNIX/usr/local/lib/libboost_signals.so

Common. copy/usr/local/lib/libboost_timer.so.1.59.0

Ln-UNIX/usr/local/lib/libboost_timer.so

Common. copy/usr/local/lib/libboost_prg_exec_monitor.so.1.59.0

Ln-UNIX/usr/local/lib/libboost_prg_exec_monitor.so

Common. copy/usr/local/lib/libboost_unit_test_framework.so.1.59.0

Ln-UNIX/usr/local/lib/libboost_unit_test_framework.so

Common. copy/usr/local/lib/libboost_wave.so.1.59.0

Ln-UNIX/usr/local/lib/libboost_wave.so

Common. copy/usr/local/lib/libboost_exception.a

Common. copy/usr/local/lib/libboost_system.a

Common. copy/usr/local/lib/libboost_chrono.a

Common. copy/usr/local/lib/libboost_timer.a

Common. copy/usr/local/lib/libboost_test_exec_monitor.a

... Updated 11816 targets...

[Root @ mdb01 boost_000059_0] #

 

Iv. mysql

1. MySQL source code installation 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

Development source tree. Other tool requirements depend on

Which installation method you use.

 

To install MySQL from source, your system must have

Following tools, regardless of installation method:

 

* CMake, which is used as the build framework on all

Platforms. CMake can be downloaded from

Http://www.cmake.org.

 

* A good make program. Although some platforms come

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 http://www.gnu.org/software/make.

 

* A working ansi c ++ compiler. GCC 4.4.6 or later, Clang

3.3 or later (FreeBSD and OS X), Visual Studio 2013 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

Version such as ActiveState Perl.

2. Check the system package version.

1) cmake

[Root @ mdb01 cmake-3.3.2] # cmake -- version

Cmake version 3.3.2

 

CMake suite maintained and supported by Kitware (kitware.com/cmake ).

[Root @ mdb01 cmake-3.3.2] #

2) make

[Root @ mdb01 cmake-3.3.2] # make-v

GNU Make 3.81

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR

Particle PURPOSE.

 

This program built for x86_64-RedHat-linux-gnu

3) gcc

[Root @ mdb01 cmake-3.3.2] # gcc-v

Using built-in specs.

Target: x86_64-redhat-linux

Configured :.. /configure -- prefix =/usr -- mandir =/usr/share/man -- infodir =/usr/share/info -- with-bugurl = http://bugzilla.redhat.com/bugzilla -- enable-bootstrap -- enable-shared -- enable-threads = posix -- enable-checking = release -- with-system-zlib -- enable-_ cxa_atexit -- disable-libunwind-exceptions -- enable-gnu-unique-object -- enable- ages = c, c ++, objc, obj-c ++, java, fortran, ada -- enable-java-awt = gtk -- disable-dssi -- with-java-home =/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre -- enable-libgcj-multifile -- enable-java -maintainer-mode -- with-ecj-jar =/usr/share/java/eclipse-ecj.jar -- disable-libjava-multilib -- with-ppl -- with-cloog -- with-tune = generic -- with-arch_32 = i686 -- build = x86_64-redhat-linux

Thread model: posix

Gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)

[Root @ mdb01 cmake-3.3.2] #

4) perl

[Root @ mdb01 cmake-3.3.2] # perl-v

 

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

 

Copyright 1987-2009, Larry Wall

 

Perl may be copied only under the terms of either the Artistic License or

GNU General Public License, which may be found in the Perl 5 source kit.

 

Complete documentation for Perl, including FAQ lists, shocould be found on

This system using "man perl" or "perldoc perl". If you have access to

Internet, point your browser at http://www.perl.org/, the Perl Home Page.

 

[Root @ mdb01 cmake-3.3.2] #

 

 

5) Other System packages

 

Ncurses-devel bison

 

[Root @ mdb01 Packages] # rpm-ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm

Warning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: ncurses-devel ##################################### ###### [100%]

[Root @ mdb01 Packages] # rpm-ivh bison-2.4.1-5.el6.x86_64.rpm

Warning: bison-2.4.1-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: bison ####################################### #### [100%]

[Root @ mdb01 Packages] #

3. Pre-installation Configuration

# Preconfiguration setup

[Root @ mdb01 soft] # groupadd mysql

[Root @ mdb01 soft] # useradd-r-g mysql

# Beginning of source-build specific instructions

[Root @ mdb01 soft] # tar zxvf mysql-5.7.9.tar.gz

[Root @ mdb01 soft] # cd mysql-5.7.9

4. Configure the installation items

[Root @ mdb01 mysql-5.7.9] # cmake \

>-DCMAKE_INSTALL_PREFIX =/opt/mysql \

>-DMYSQL_DATADIR =/opt/mysql/data \

>-DSYSCONFDIR =/etc \

>-DWITH_MYISAM_STORAGE_ENGINE = 1 \

>-DWITH_INNOBASE_STORAGE_ENGINE = 1 \

>-DWITH_PARTITION_STORAGE_ENGINE = 1 \

>-DMYSQL_UNIX_ADDR =/opt/mysql. sock \

>-DMYSQL_TCP_PORT = 3306 \

>-DENABLED_LOCAL_INFILE = 1 \

>-DEXTRA_CHARSETS = all \

>-DDEFAULT_CHARSET = utf8 \

>-DDEFAULT_COLLATION = utf8_general_ci

 

5. Compile MySQL

[Root @ mdb01 mysql-5.7.9] # make

 

6. Install MySQL

[Root @ mdb01 mysql-5.7.9] # make install

# End of source-build specific instructions

 

5. Post-installation Configuration

# Postinstallation setup

1. directory permission

Shell> cd/opt/mysql

Shell> chown-R mysql.

Shell> chgrp-R mysql.

2. initialize the database

Shell> bin/mysql_install_db -- user = mysql # Before MySQL 5.7.6

Shell> bin/mysqld -- initialize -- user = mysql # MySQL 5.7.6 and up

Execution result:

[Root @ mdb01 mysql] # bin/mysqld -- initialize -- user = mysql

2015-10-29T21: 58: 57.465483Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details ).

2015-10-29T21: 58: 59.889999Z 0 [Warning] InnoDB: New log files created, LSN = 45790

2015-10-29T21: 59: 00.201432Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-10-29T21: 59: 00.398966Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: Large.

2015-10-29T21: 59: 00.406427Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql. gtid_executed' cannot be opened.

2015-10-29T21: 59: 00.20.627z 1 [Note] A temporary password is generated for root @ localhost: Ek &! SA9 (qYds

[Root @ mdb01 mysql] # ls

Bin COPYING data docs include INSTALL-BINARY lib man mysql-test README share support-files

[Root @ mdb01 mysql] #

3. Certificate-related

Shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up

Execution result

[Root @ mdb01 mysql] # bin/mysql_ssl_rsa_setup

Generating a 2048 bit RSA private key

... ++

... + +

Writing new private key to 'Ca-key. pem'

-----

Generating a 2048 bit RSA private key

........................................ ........................................ ........................................ ........................................ ......................... ++

. ++

Writing new private key to 'server-key. pem'

-----

Generating a 2048 bit RSA private key

....................................

... + +

Writing new private key to 'client-key. pem'

-----

[Root @ mdb01 mysql] #

4. modify directory permissions

Shell> chown-R root.

Shell> chown-R mysql data

 

Basedir mysql user

[Root @ mdb01 mysql-5.7.9] # cd/opt

[Root @ mdb01 opt] # chown mysql

[Root @ mdb01 opt] # ll

Total 4

Drwxr-xr-x. 11 mysql 4096 Oct 30 mysql

 

5. Start MySQL

Shell> bin/mysqld_safe -- user = mysql &

 

6. First Login to MySQL

1. log on to MySQL

[Root @ rhel6 mysql] # bin/mysql-u root-p

Enter password: the temporary password generated during installation (Ek &! SA9 (qYds)

Welcome to the MySQL monitor. Commands end with; or \ g.

Your MySQL connection id is 3

Server version: 5.7.9-log

 

Copyright (c) 2000,201 5, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

 

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

 

Mysql>

 

2. Change the root password of the logon password.

 

* As of MySQL 5.7.6, use alter user:

 

Mysql> alter user 'root' @ 'localhost' identified by '20140901 ';

Query OK, 0 rows affected (0.02 sec)

Mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

3. Configure the startup Item

 

# Next command is optional

Shell> cp support-files/mysql. server/etc/init. d/mysqld

 

PATH Environment Variable

Vi/etc/profile

.....

.....

Unset I

Unset pathmunge

Export PATH =/opt/mysql/bin: $ PATH

This article permanently updates the link address:

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.