1, source code compilation install MySQL (version 5.7)
:
Https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz
# (after MySQL from the 5.7 version, boost is required, it is recommended to bring the system's own boost library uninstall, source code compiled to install the high version
Boost Library is for C + + The language standard library provides some of the extensions C + + the generic name of the library )
(1) Environment preparation:
[[email protected] ~]# ls
mysql-boost-5.7.18.tar.gz nginx-1.10.3.tar.gz nginx.conf pcre-8.38.tar.gz php-7.0.18.tar.gz
# Uninstall system comes with Boots library
[Email protected] ~]# yum-y Remove boost-*
# Uninstalling the system comes with MySQL
[[email protected] ~]# yum-y remove MySQL
[Email protected] ~]# Rpm-qa | grep MySQL
Mysql-libs-5.1.73-5.el6_6.x86_64
[Email protected] ~]# rpm-e--nodeps mysql-libs-5.1.73-5.el6_6.x86_64
[Email protected] ~]# Rpm-qa | grep MySQL
# Install the necessary resource packs
It is recommended to use the network Yum Source, the RHEL6.5 CD-ROM package version is not enough, mysql-boost-5.7.18.tar.gz compilation of the package version requirements are relatively high, where CMake version is not less than 2.8
# Install dependent packages
[email protected] ~]# yum install-y cmake make gcc gcc-c++ bison ncurses ncurses-devel
(2) Adding users and Groups
[[email protected] ~]# Groupadd MySQL
[[email protected] ~]# useradd-m-s/sbin/nologin-r-g MySQL MySQL
(3) Create the installation directory and data storage directory
[Email protected] ~]# mkdir-p/server/mysql
(4) upload the source package and unzip the source package
[[email protected] lamp]# ls
[Email protected] ~]# tar zxf mysql-boost-5.7.18.tar.gz-c/server/
(5) Move boost to/server/
[email protected] server]# CD mysql-5.7.18/ (files that contain boost libraries)
# Move the boots file to the/server/mysql/
[Email protected] mysql-5.7.18]# MV boost//server/mysql
[Email protected] mysql-5.7.18]# Cd/server/mysql
[[email protected] mysql]# ls
Boost
(6) Configuration parameters
[Email protected] mysql]# CD. /
[[email protected] server]# ls
MySQL mysql-5.7.18
[Email protected] server]# CD mysql-5.7.18/
[[email protected] mysql-5.7.18] #cmake-dcmake_install_prefix=/server/mysql-dmysql_datadir=/server/mysql/data- Dsysconfdir=/etc-dmysql_unix_addr=/server/mysql/mysql.sock-dwith_myisam_storage_engine=1-dwith_innobase_ storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_unix_addr=l-dmysql_tcp_port=3306- Denabled_local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_charset=utf8-ddefault_ Collation=utf8_general_ci-ddownload_boost=1-dwith_boost=/server/mysql/boost
The Help for these compilation parameters looks for a method:
http://www.mysql.com →→ documentation →→ Select the corresponding version (5.7) Installation & upgrades →→ installing MySQL from source →→ mysql source-configuration Options
the final URL H ttps://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html
Dcmake_install_prefix : Specifies the installation directory of the MySQL program, default/usr/local/mysql
Default_charset: Specifies the server default character set, default Latin1
Default_collation: Specifies the default proofing rules for the server, default Latin1_general_ci
Enabled_local_infile: Specifies whether to allow load DATA INFILE to be executed locally, by default off
With_comment: Specifying compilation Notes Information
With_xxx_storage_engine: Specifies a storage engine that is statically compiled to MySQL, and the Myisam,merge,member and CSV four engines are compiled to the server by default and do not require special designation.
Without_xxx_storage_engine: Specifying a storage engine that does not compile
Sysconfdir: Initialize parameter file directory
Mysql_datadir: Data Files directory
Mysql_tcp_port: Service port number, default 3306
Mysql_unix_addr:socket file path, default/tmp/mysql.sock
Compile
mysql-5.7.18.tar.gz compile-time consumes a lot of system resources, it is recommended to use more than one core to compile at the same time, or it may fail to compile
(7) Compiling
# To View the number of server CPUs
[[email protected] mysql-5.7.18]# grep processor/proc/cpuinfo | Wc-l
2
[Email protected] mysql-5.7.18]# Make-j 2
(8) Installation
[[email protected] mysql-5.7.18]# make install
(9) Modify directory Permissions
[Email protected] mysql-5.7.18]# chown-r mysql:mysql/server/mysql/
(10) Generate configuration file
# Move the original server configuration file back up or delete
[[email protected] mysql-5.7.18]# Mv/etc/my.cnf{,.bak}
# because version 5.7 does not have this configuration template file/server/mysql/support-files/my-default.cnf
# Write your own my.cnf file
[[email protected] mysql-5.7.18] #vim/etc/my.cnf
[Mysqld]
Sql_mode=no_engine_substitution,strict_trans_tables
#default
user = MySQL
Basedir =/server/mysql
DataDir =/server/mysql/data
Port = 3306
Pid-file =/server/mysql/data/mysql.pid
Socket =/server/mysql/mysql.sock
Character-set-server=utf8
[Client]
Socket =/server/mysql/mysql.sock
(11) Build service startup script
grep chkconfig./*-r-color
[Email protected] mysql]# Cp/server/mysql/support-files/mysql.server/etc/init.d/mysqld
[Email protected] mysql]# chmod +x/etc/init.d/mysqld
[Email protected] mysql]# chkconfig--add mysqld
[Email protected] mysql]# chkconfig mysqld on
[Email protected] mysql]# chkconfig--list mysqld
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
(12) Initializing the database
[Email protected] mysql]#/server/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/server/mysql-- Datadir=/server/mysql/data
(13) Start-up service
[Email protected] mysql]# service mysqld restart
error! MySQL server PID file could not being found!
Starting mysql.logging to '/server/mysql/data/wg64.err '.
success!
[Email protected] mysql]# service mysqld restart
Shutting down MySQL. success!
Starting MySQL. success!
(15) Optimize call command path
# Add path Path: Vim/etc/profile Add the following 2 lines at the end of the file
Export Mysql_home=/server/mysql
Export path= $PATH: $MYSQL _home/bin
# make the changes effective
Source/etc/profile
Or
[Email protected] mysql]# ln-s/server/mysql/bin/*/usr/local/bin/
(14) Modify MySQL password test log in:
[[email protected] ~]# mysqladmin-u root password "123456"
Mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning:since password is sent to server in plain text, use SSL connection to ensure password safety.
Test Log in Success:
Source code compilation LNMP Please refer to the link: http://blog.51cto.com/13719714/2110940
source Compile lamp Please refer to link: http://blog.51cto.com/13719714/2109227
Apache Basic Tuning please refer to link: http://blog.51cto.com/13719714/2109007
Source code compilation Install Mysql5.7 version