centos7.4 MySQL 5.7.20 source installation

Source: Internet
Author: User
Tags mkdir

1. Installation Dependencies

Yum install-y cmake Bison bison-devel libaio-devel gcc gcc-c++ git ncurses-devel

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20.tar.gz

wget https://zh.osdn.net/projects/sfnet_boost/downloads/boost/1.59.0/boost_1_59_0.tar.gz/

2. Unzip the build installation

[Email protected] ~]# Tar XF mysql-5.7.20.tar.gz

[Email protected] ~]# MV boost_1_59_0.tar.gz mysql-5.7.20

[Email protected] ~]# CD mysql-5.7.20

[Email protected] mysql-5.7.20]# mkdir Configure

[Email protected] mysql-5.7.20]# CD Configure

[Email protected] configure]# CMake. -dbuild_config=mysql_release \

-dinstall_layout=standalone \

-dcmake_build_type=relwithdebinfo \

-denable_dtrace=off \

-dwith_embedded_server=off \

-dwith_innodb_memcached=on \

-dwith_ssl=bundled \

-dwith_zlib=system \

-dwith_pam=on \


-dinstall_plugindir= "/var/mysql/lib/plugin" \

-ddefault_charset=utf8 \


-dwith_editline=bundled \

-dfeature_set=community \

-dcompilation_comment= "MySQL Server (GPL)" \

-dwith_debug=off \


[[email protected] configure]# make

[[email protected] configure]# make install # This step is slow

3. Create profile directory and user

[[email protected] ~]# useradd-s/sbin/nologin MySQL

[Email protected] ~]# mkdir-p/data/mysql

[Email protected] ~]# mkdir-p/var/mysql/log

[Email protected] ~]# chown-r mysql:mysql/data/mysql/

[Email protected] ~]# chown-r Mysql:mysql/var/mysql/log

4. Modify the configuration file

[Email protected] ~]# VIM/ETC/MY.CNF







5. Initialization

[Email protected] ~]#/var/mysql/bin/mysqld--initialize--user=mysql

[Email protected] ~]# ll/data/mysql/

Total 110628

-rw-r-----. 1 MySQL MySQL 17:51 auto.cnf

-rw-r-----. 1 mysql mysql 419 Jul 17:51 Ib_buffer_pool

-rw-r-----. 1 mysql mysql 12582912 Jul 17:51 ibdata1

-rw-r-----. 1 mysql mysql 50331648 Jul 17:51 ib_logfile0

-rw-r-----. 1 mysql mysql 50331648 Jul 17:51 ib_logfile1

Drwxr-x---. 2 mysql mysql 4096 Jul 17:51 MySQL

Drwxr-x---. 2 mysql mysql 8192 Jul 17:51 performance_schema

Drwxr-x---. 2 mysql mysql 8192 Jul 17:51 sys

[Email protected] ~]# ll/var/mysql/log/

Total 4

-rw-r-----. 1 MySQL MySQL 802 Jul 17:51 Error.log

6. Modify the configuration file

[Email protected] ~]# Cp/var/mysql/support-files/mysql.server/etc/init.d/mysqld

[Email protected] ~]# vim/etc/init.d/mysqld #找到如下两行





[Email protected] ~]# mkdir-p/var/lib/mysql

[Email protected] ~]# chown-r mysql:mysql/var/lib/mysql

7. Add Environment variables

[Email protected] mysql]# Vim/etc/profile



Path= $PATH: $MYSQL _home

[Email protected] ~]# Source/etc/profile

8. Modify the original password

[Email protected] ~]# Cat/var/mysql/log/error.log | grep generated

2018-07-10t09:51:31.365809z 1 [Note] A temporary password is generated for [email protected]: ps:scg1gophj

[[email protected] ~]#/etc/init.d/mysqld start

[Email protected] ~]# ln-s/var/lib/mysql/mysql.sock/tmp/

[Email protected] ~]# mysql-uroot-p

The password is: ps:scg1gophj

mysql> alter user ' root ' @ ' localhost ' identified by ' 123123 ';

Query OK, 0 rows Affected (0.00 sec)

mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)

centos7.4 MySQL 5.7.20 source installation

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.