Detailed installation process of source code in the latest version of MySQL5.7.10

Source: Internet
Author: User
Tags ssl connection automake

Detailed installation process of source code in the latest version of MySQL5.7.10
1 ,:

Package: http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz

You can download wget or remote upload from a local pc to linux.


Installation document address: http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html

The document is dry here:

# Preconfiguration setup

Shell>Groupadd mysql

Shell>Useradd-r-gmysql-s/bin/false mysql

# Beginning of source-build specificinstructions

Shell>Tar zxvf mysql-VERSION.Tar.gz

Shell>Cd mysql-VERSION

Shell>Cmake.

Shell>Make

Shell>Make install

# End of source-build specific instructions

# Postinstallation setup

Shell>Cd/usr/local/mysql

Shell>Chown-R mysql.

Shell>Chgrp-R mysql.

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

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

Shell>Bin/mysql_ssl_rsa_setup# MySQL 5.7.6 and up

Shell>Chown-R root.

Shell>Chown-R mysqldata

Shell>Bin/mysqld_safe -- user = mysql &

# Next command is optional

Shell>Cpsupport-files/mysql. server/etc/init. d/mysql. server

PS: The difference is,Bin/mysqld -- initialize -- user = mysql# MySQL 5.7.6 and up

2. Add a mysql user

Groupadd mysql

3. install Component preparation

Yum install gcc-c ++-y

4. Database Planning

Mysql software Directory:/usr/local/mysql5710

Mysql data DIRECTORY:/home/data/mysql5710/data/

Mysql log Directory:/home/data/mysql5710/log/


Mkdir-p/home/data/mysql5710/log/

The blog address of the original blogger csdn: blog.

5. Start pre-Compilation

Time cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql5710-DMYSQL_DATADIR =/home/data/mysql5710/data-DWITH_INNOBASE_STORAGE_ENGINE = 1-DMYSQL_UNIX_ADDR =/usr/local/mysql5710/mysql. sock-DMYSQL_USER = mysql-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci

Error message:

CMake Error at cmake/boost. cmake: 76 (MESSAGE ):

Youcan download it with-DDOWNLOAD_BOOST = 1-DWITH_BOOST = <directory>

This CMake script will look for boost in <directory>. If it is not there,

Itwill download and unpack it (in that directory) for you.

Ifyou are inside a firewall, you may need to use an http proxy:

Add the parameter-DDOWNLOAD_BOOST = 1-DWITH_BOOST =/home/mysql5710/to continue Compilation:

Time cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql5710-DMYSQL_DATADIR =/home/data/mysql5710/data-DWITH_INNOBASE_STORAGE_ENGINE = 1-DMYSQL_UNIX_ADDR =/usr/local/mysql5710/mysql. sock-DMYSQL_USER = mysql-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DDOWNLOAD_BOOST = 1-DWITH_BOOST =/usr/local/boost/

Error message:

-- [Download 31% complete]

-- Download failed, error: 28; "Timeoutwas reached"

CMake Error at cmake/boost. cmake: 177 (MESSAGE ):

Youcan try downloading

Http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

Manually using curl/wget or a similar tool, or increase the value

DOWNLOAD_BOOST_TIMEOUT (which is now 600 seconds)

Call Stack (most recent call first ):

CMakeLists.txt: 435 (INCLUDE)

-- Refreshing incomplete, errors occurred!

Then proceed and set a DOWNLOAD_BOOST_TIMEOUT = 28800 to continue the download:

[Root @ wgq_idc_mon_1_12 mysql-5.7.10] # timecmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql5710-DMYSQL_DATADIR =/home/data/mysql5710/data-DWITH_INNOBASE_STORAGE_ENGINE = 1-DMYSQL_UNIX_ADDR =/usr/local/mysql5710/mysql. sock-DMYSQL_USER = mysql-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DDOWNLOAD_BOOST = 1-DWITH_BOOST =/usr/local/boost/-DOWNLOAD_BOOST_TIMEOUT = 28800

No. The same error is reported. You still need to download it manually.

Mkdir-p/usr/local/boost

Wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

Then continue Compilation:

Time cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql5710-DMYSQL_DATADIR =/home/data/mysql5710/data-DWITH_INNOBASE_STORAGE_ENGINE = 1-DMYSQL_UNIX_ADDR =/usr/local/mysql5710/mysql. sock-DMYSQL_USER = mysql-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_BOOST =/usr/local/boost/

It is best to see the following information to indicate that the compilation is successful:

......

-- CMAKE_BUILD_TYPE: RelWithDebInfo

-- COMPILE_DEFINITIONS: _ GNU_SOURCE; _ FILE_OFFSET_BITS = 64; HAVE_CONFIG_H

-- CMAKE_C_FLAGS:-Wall-Wextra-Wformat-security-Wvla-Wwrite-strings-Wdeclaration-after-statement

-- CMAKE_CXX_FLAGS:-Wall-Wextra-Wformat-security-Wvla-Woverloaded-virtual-Wno-unused-parameter

-- CMAKE_C_FLAGS_RELWITHDEBINFO:-O3-g-fabi-version = 2-fno-omit-frame-pointer-fno-strict-aliasing-DDBUG_OFF

-- CMAKE_CXX_FLAGS_RELWITHDEBINFO:-O3-g-fabi-version = 2-fno-omit-frame-pointer-fno-strict-aliasing-DDBUG_OFF

-- Processing ing done

-- Generating done

-- Build files have been written to:/root/mysql-5.7.10

6, time make

It takes a long time to wait, as shown below:

[Root @ wgq_idc_mon_1_12 mysql-5.7.10] # timemake

......

Scanning dependencies of targetmysql_embedded

[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysql_embedded.dir/_/client/completion_hash.cc.o

[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysql_embedded.dir/_/client/mysql. cc. o

[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysql_embedded.dir/_/client/readline. cc. o

Linking CXX executable mysql_embedded

[1, 100%] Built target mysql_embed

Scanning dependencies of targetmysqltest_embedded

[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysqltest_embedded.dir/_/client/mysqltest. cc. o

Linking CXX executable mysqltest_embedded

[1, 100%] Built target mysqltest_embed

Scanning dependencies of targetmy_safe_process

[100%] Building CXX objectmysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o

Linking CXX executable my_safe_process

[1, 100%] Built target my_safe_process

7. time make install

This execution is faster, as shown below:

[Root @ wgq_idc_mon_000012 mysql-5.7.10] # timemake install

......

-- Installing:/usr/local/mysql5710/mysql-test/lib/My/SafeProcess/my_safe_process

-- Up-to-date:/usr/local/mysql5710/mysql-test/lib/My/SafeProcess/my_safe_process

-- Installing:/usr/local/mysql5710/mysql-test/lib/My/SafeProcess/Base. pm

-- Installing: // usr/local/mysql5710/support-files/my-default.cnf

-- Installing:/usr/local/mysql5710/support-files/mysqld_multi.server

-- Installing:/usr/local/mysql5710/support-files/mysql-log-rotate

-- Installing:/usr/local/mysql5710/support-files/magic

-- Installing:/usr/local/mysql5710/share/aclocal/mysql. m4

-- Installing:/usr/local/mysql5710/support-files/mysql. server

8. Configure the my. cnf startup parameter file.

[Client]

# Password = [your_password]

Port = 3308

Socket =/usr/local/mysql5710/mysql. sock

Loose-default-character-set = gbk

[Mysqld]

Default-storage-engine = INNODB

Group_concat_max_len= 99999

# Generic configuration options

Port = 3307

Socket =/usr/local/mysql5710/mysql. sock

Pid-file =/usr/local/mysql5710/mysqld. pid

Datadir =/home/data/mysql5710/data

User = mysql

SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES

Skip-external-locking

Skip-name-resolve

Explicit_defaults_for_timestamp

......

9. 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

Shell>Bin/mysql_ssl_rsa_setup# MySQL 5.7.6 and up

9.1 use my. cnf for initialization

[Root @ wgq_idc_mon_000012 root] # cd/usr/local/mysql5710/bin/

[Root @ wgq_idc_mon_1_12 bin] #. /mysqld -- initialize -- user = mysql -- basedir =/usr/local/mysql5710 -- datadir =/home/data/mysql5710/data -- defaults-file =/usr/local/mysql5710/ my. cnf

2015-12-17T09: 44: 00.021750Z 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for moredetails ).

2015-12-17T09: 44: 00.462018Z 0 [Warning] InnoDB: New log files created, LSN = 45790

2015-12-17T09: 44: 00.652738Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-12-17T09: 44: 00.712997Z 0 [ERROR] unknownvariable 'defaults'-file =/usr/local/mysql5710/my. cnf'

2015-12-17T09: 44: 00.713034Z 0 [ERROR] Aborting

[Root @ wgq_idc_mon_1_12 bin] #

It seems that an error is reported. The defaults-file parameter is not recognized.

9.2 start by default

The following error is reported:

[Root @ wgq_idc_mon_1_12 bin] # rm-rf/home/data/mysql5710/data /*

[Root @ wgq_idc_mon_1_12 bin] #./mysqld -- initialize -- user = mysql -- basedir =/usr/local/mysql5710 -- datadir =/home/data/mysql5710/data

2015-12-17T09: 48: 07.344700Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for moredetails ).

2015-12-17T09: 48: 07.705225Z 0 [Warning] InnoDB: New log files created, LSN = 45790

2015-12-17T09: 48: 07.795939Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-12-17T09: 48: 07.807878Z 0 [Warning] Noexisting UUID has been found, so we assume that this is the first time thatthis server has been started. Generating a new UUID: Warning.

2015-12-17T09: 48: 07.809546Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql. gtid_executed' cannot beopened.

2015-12-17T09: 48: 07.811257Z 1 [Note] Atemporary password is generated for root @ localhost: 4e3taITlXU %/

[Root @ wgq_idc_mon_1_12 bin] #

PS: Check that there is an initial root password. Write it down. Otherwise, after mysql is started, the system reports a wrong password and cannot log on.

10. Install ssl

[Root @ wgq_idc_mon_1_12 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 @ wgq_idc_mon_1_12 bin] #

11. Deploy and start the service

Preparation Service:

[Root @ wgq_idc_mon_1_12 bin] # cp ../support-files/mysql. server/etc/init. d/mysqld5710

[Root @ wgq_idc_mon_1_12 bin] # chmod 700/etc/init. d/mysqld5710

[Root @ wgq_idc_mon_1_12 bin] # echo "export PATH = $ PATH:/usr/local/mysql5710/bin">/etc/profile

[Root @ wgq_idc_mon_1_12 bin] # source/etc/profile

[Root @ wgq_idc_mon_1_12 bin] #

Set startup

[Root @ wgq_idc_mon_1_12 bin] # chkconfigmysqld5710 on

[Root @ wgq_idc_mon_1_12 bin] #

Startup error:

[Root @ wgq_idc_mon_1_12 bin] # servicemysqld5710 start

Starting MySQL... The server quit withoutupdating PID file [failed]/local/mysql5710/mysqld. pid ).

[Root @ wgq_idc_mon_1_12 bin] #

View the background error log mysqld. log:

2015-12-17T09: 54: 40.004720Z 0 [ERROR] InnoDB: redo log file './ib_logfile0' exists. Creating system tablespace withexisting redo log files is not recommended. Please delete all redo log file

S before creating new system tablespace.

2015-12-17T09: 54: 40.004744Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Generic error. You mayneed to delete the ibdata1 file before trying to start up again.

2015-12-17T09: 54: 40.305233Z 0 [ERROR] Plugin 'innodb' init function returned error.

2015-12-17T09: 54: 40.305292Z 0 [ERROR] Plugin 'innodb' registration as a storage engine failed.

2015-12-17T09: 54: 40.305305Z 0 [ERROR] Failed to initialize plugins.

2015-12-17T09: 54: 40.305315Z 0 [ERROR] Aborting

2015-12-17T09: 54: 40.305333Z 0 [Note] Binlogend

2015-12-17T09: 54: 40.306240Z 0 [Note]/usr/local/mysql5710/bin/mysqld: Shutdown complete

Solution:

[Root @ wgq_idc_mon_1_12 data] # rm-rfib_logfile0 ib_logfile1

[Root @ wgq_idc_mon_1_12 data] #


Then start mysql. The error message is as follows:

2015-12-17T10: 02: 46.169594Z 0 [Warning] InnoDB: Cannot open tablemysql/plugin from the internal data dictionary of InnoDB though the. frm filefor the table exists. Please refer to http: // de

V.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how toresolve the issue.

Mysqld: Table 'mysql. plugin 'doesn' t exist

2015-12-17T10: 02: 46.169680Z 0 [ERROR] Can't open the mysql. plugintable. Please run mysql_upgrade to create it.

2015-12-17T10: 02: 46.169907Z 0 [ERROR] unknown variable 'max _ connection = 661'

2015-12-17T10: 02: 46.169928Z 0 [ERROR] Aborting

Modify max_connection = 10000 in my. cnf. The following error is reported in succession:

2015-12-17T10: 07: 22.243181Z 0 [ERROR] unknown variable 'max _ user_connection = 8080'

2015-12-17T10: 16: 15.87020.z 0 [ERROR] unknown variable 'thread _ concurrency = 8'

2015-12-17T10: 16: 51.2520.1z 0 [ERROR] unknown option '-- myisam_recover'

Then comment out all in my. cnf and start the mysqld service. The service is started normally, as shown below:

[Root @ wgq_idc_mon_000012 mysql5710] # servicemysqld5710 start

Starting MySQL .. [OK]

[Root @ wgq_idc_mon_000012 mysql5710] #

So far, mysql5.7.10 has been successfully installed and deployed.

12. Reset the password.

Use mysqladmin to reset the password

[Root @ wgq_idc_mon_000012 mysql5710] #. /bin/mysqladmin-h localhost-uroot password "root"-p '4e3taitlxu %/'-- socket =/usr/local/mysql5710/mysql. sock

Mysqladmin: [Warning] Using a password onthe command line interface can be insecure.

Warning: Since password will be sent toserver in plain text, use ssl connection to ensure password safety.

[Root @ wgq_idc_mon_000012 mysql5710] #

Log on with the new password:

[Root @ wgq_idc_mon_000012 mysql5710] # mysql -- socket =/usr/local/mysql5710/mysql. sock-uroot-proot

Warning: Using a password on the commandline interface can be insecure.

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

Your MySQL connection id is 7

Server version: 5.7.10-log Sourcedistribution

Copyright (c) 2000,201 3, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its

Affiliates. Other names may be trademarksof their respective

Owners.

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

Mysql>

OK. mysql5.7.10 installation is complete. You can verify the new features of MySQL 5.7.

13. Additional articles

Optional buffer, size, cache, and so on are all configured at the minimum. No SQL request is required, and even innodb is disabled.

So I want to discuss his symptoms.

After mysql5.7 is started, the remaining MB memory is as follows:

[Root @ wgq_idc_mon_1_12 mysql-5.7.10] #

[Root @ wgq_idc_mon_000012 mysql-5.7.10] # free-m

Total used free shared buffers cached

Mem: 32110 30182 1927 0 349 24095

-/+ Buffers/cache: 5737 26372

Swap: 3967 12 3955

[Root @ wgq_idc_mon_1_12 mysql-5.7.10] #

[Root @ wgq_idc_mon_1_12 mysql-5.7.10] #

After mysql5.7 is stopped, the remaining 2841m memory is as follows:

[Root @ wgq_idc_mon_000012 mysql-5.7.10] # service mysqld5710 stop

Shutting down MySQL... [OK]

[Root @ wgq_idc_mon_000012 mysql-5.7.10] # free-m

Total used free shared buffers cached

Mem: 32110 29268 2841 0 349 24083

-/+ Buffers/cache: 4835 27274

Swap: 3967 12 3955

[Root @ wgq_idc_mon_1_12 mysql-5.7.10] #

About a GB is used, and my buffer_pool setting is 4 GB. It may be the memory consumption for starting mysql to load the buffer pool, which needs to be verified later.

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.