Compiling and installing MySQL-5.7.13

Source: Internet
Author: User
Tags openssl uuid

Compiling and installing MySQL-5.7

One of the important characteristics of CMake is its independent of the source code (OUT-OF-SOURCE) of the compilation function, that is, the compilation work can be in another specified directory rather than the source directory, which can ensure that the source directory is not affected by any one compilation, so in the same source tree can be many different compilations, such as for different platforms to compile.

Compiling and installing MySQL-5.7

+++++++++++++++++++++++++
Os:centos7 & 3.10.0-327.el7.x86_64
Mysql:mysql-boost-5.7.13.tar.gz
+++++++++++++++++++++++++

First, install the CMake

Cross-platform compilers

https://cmake.org/download/

wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gztar XF cmake- 3.5. 2. Tar . gz# CD CMake-3.5. 2  Yuminstallmakegccgcc-c++ ncurses-devel#. /Install

Second, compile and install MySQL

0. Download MySQL

wget http://cdn.mysql.com//downloads/mysql-5.7/ Mysql-boost-5.7.13.tar.gz

1. Compile mysql-5.7 with CMake
CMAKE specifies compilation options in a different way from make, which is implemented in the following way:

Make                 | cmake---------------------|--------------------------. /configure          |  CMake . /configure--help   |cmake.-lh or Ccmake.

-L[A][H]

List non-advanced Cached variables.
List cache variables would run CMake and list all the variables from the CMake cache that is not marked as INTERNAL or ADV anced. This would effectively display current CMake settings, which can and be changed with-d option. Changing some of the variables may result in more variables being created. If A is specified, then it would display also advanced variables. If H is specified, it'll also display Help for each variable.

Specifies the options that are commonly used when installing the installation path of a file:
-dcmake_install_prefix=/usr/local/mysql
-dmysql_datadir=/data/mysql
-dsysconfdir=/etc


The storage engines that are compiled by default include: CSV, MyISAM, MYISAMMRG, and heap. To install additional storage engines, you can use a compilation option similar to the following:
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1

To explicitly specify that a storage engine is not compiled, you can use an option similar to the following:
-dwithout_<engine>_storage_engine=1
Like what:
-dwithout_example_storage_engine=1
-dwithout_federated_storage_engine=1
-dwithout_partition_storage_engine=1

If you want to compile into other functions, such as SSL, you can use a library similar to the following, or do not use a library when compiling:
-dwith_readline=1
-dwith_ssl=system
-dwith_zlib=system
-dwith_libwrap=0

Other common options:
-dmysql_tcp_port=3306
-dmysql_unix_addr=/tmp/mysql.sock
-denabled_local_infile=1
-dextra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_debug=0
-denable_profiling=1

If you want to clean up the files generated by the previous compilation, you need to use the following command:

 Make  Clean RM CMakeCache.txt


2. Compile and install

Starting the boost library from MySQL 5.7.5 is required
Download MYSQL-BOOST-5.7.12.TAR.G Specify parameters in CMake-dwith_boost=boost/boost_1_59_0/
or directly cmake specified parameters-ddownload_boost=1-dwith_boost=<directory> the system will download BOOST

#mkdir-p/usr/local/mysql/mydata/data# Groupadd-R mysql# Useradd-G Mysql-r-d/data/MyData mysql#Chown-R mysql.mysql/usr/local/mysql/mydata/data#wgethttp//sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz#TarXF mysql-boost-5.7. -.Tar. gz# CD MySQL-5.7. -# Yum Install-Y OpenSSL openssl-devel# CMake.-dcmake_install_prefix=/usr/local/MySQL-dmysql_datadir=/mydata/Data-dsysconfdir=/etc-dwith_innobase_storage_engine=1 -dwith_archive_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwith_readline=1 -dwith_libwrap=0 -dmysql_unix_addr=/tmp/Mysql.sock-dwith_ssl=system-dwith_zlib=system-dwith_boost=/home/alex/downloads/Boost_1_59_0-ddefault_charset=UTF8-ddefault_collation=utf8_general_ci

Prompt error, need to install bison*

CMake Warning at Cmake/bison.cmake: the pathcall Stack (most recent call first): SQL /cmakelists.txt:527  (INCLUDE) CMake Warning at CMake/bison.cmake: Pathcall Stack (most recent call first): Libmysqld/cmakelists.txt:159Yum Install bison*

make makeinstall 

Configure MySQL and start.

#CP./support-files/mysql.server/etc/init.d/mysqld#chmod+x/etc/init.d/mysqld# chkconfig--add mysqld# chkconfig mysqld on# chkconfig|grepMysqlmysqld0: Off1: Off2: On3: On4: On5: On6: off# usermod-d/home/mysql-p mysql-s/bin/Bash mysql#pwd/usr/local/mysql#mkdirmysql-files#chmod  -mysql-files#Chown-R mysql.mysql. /mysql/# ./bin/mysqld--initialize--user=MySQL .- --04T12: $: -.885226Z0[Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for  Moredetails). .- --04T12: $: -.765474Z0[Warning] Innodb:new log files created, lsn=45790 .- --04T12: $: +.029232Z0[Warning] innodb:creating FOREIGN KEY constraint system tables. .- --04T12: $: +.165514Z0[Warning] No existing UUID have been found, so we assume that the first TimeThat this server has been started. Generating a new uuid:2a23590f-41e5-11e6-822e-000c29d052cc. .- --04T12: $: +.168762Z0[Warning] Gtid table is not a ready-to-be used. Table'mysql.gtid_executed'cannot be opened. .- --04T12: $: -.935023Z0[Warning] CA certificate Ca.pem is self signed. .- --04T12: $: +.242525Z1[Note] A temporary password is generated for[email protected]: ywsv2mg (tryr#./bin/mysql_ssl_rsa_setup#ChownMysql.mysql./mysql-files/# mysql-U Root-penter password:ywsv2mg (tryrmysql> Set Password for 'Root'@'localhost'=password ('Root'); Query OK,0Rows affected,1Warning (0.00sec) MySQL>[[email protected] mysql]# MySQL-U Root-Penter Password:welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connectionIDIs5Server Version:5.7. -Source Distributioncopyright (c) -, ., Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h'  forHelp. Type'\c'ToClearThe current input statement.mysql>MySQL>

Compiling and installing MySQL-5.7.13

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.