Detailed tutorial on installing MySQL 8.0 from source code on CentOS 7.4

Detailed tutorial on installing MySQL 8.0 from source code on CentOS 7.4

MySQL 8 official version 8.0.11 has been released. Officials say MySQL 8 is 2 times faster than MySQL 5.7 and brings a lot of improvements and faster performance!

The following is a record of my installation process on April 23, 2018. The whole process takes about an hour, and the make && make install process takes longer.

1. Environment

CentOS7.4 64-bit Minimal Installation

2. Preparation

1. Install dependencies

 yum -y install wget cmake gcc gcc-c++ ncurses ncurses-devel libaio-devel openssl openssl-devel

2. Download the source package

 wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.11.tar.gz (this version comes with boost)

3. Create mysql user

 groupadd mysql
    useradd -r -g mysql -s /bin/false mysql

4. Create installation directory and data directory

   mkdir -p /usr/local/mysql
   mkdir -p /data/mysql

3. Install MySQL 8.0.11

1. Unzip the source package

tar -zxf mysql-boost-8.0.11.tar.gz -C /usr/local

2. Compile & Install

   cd /usr/local/mysql-8.0.11
   cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=/usr/local/mysql-8.0.11/boost 
   make && make install

3. Configure my.cnf file

cat /etc/my.cnf
   [mysqld]
   server-id=1
   port=3306
   basedir=/usr/local/mysql
   datadir=/data/mysql
   ##Please add parameters according to the actual situation

4. Directory permission modification

chown -R mysql:mysql /usr/local/mysql
   chown -R mysql:mysql /data/mysql
   chmod 755 /usr/local/mysql -R
   chmod 755 /data/mysql -R

5. Initialization

bin/mysqld --initialize --user=mysql --datadir=/data/mysql/
   bin/mysql_ssl_rsa_setup

6. Start mysql

 bin/mysqld_safe --user=mysql &

7.Change account password

  bin/mysql -uroot -p
   mysql> alter user 'root'@'localhost' identified by "123456";
    mysql> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    |mysql |
    | performance_schema |
    |sys|
    +--------------------+
    4 rows in set (0.00 sec)
    ##Add a remote special account mysql> create user root@'%' identified by '123456';
    Query OK, 0 rows affected (0.08 sec)
    mysql> grant all privileges on *.* to root@'%';
    Query OK, 0 rows affected (0.04 sec)
    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)

8. Create a soft link (optional)

 ln -s /usr/local/mysql/bin/* /usr/local/bin/
    mysql -h 127.0.0.1 -P 3306 -uroot -p123456 -e "select version();"
    mysql: [Warning] Using a password on the command line interface can be insecure.
    +-----------+
    | version() |
    +-----------+
    | 8.0.11 |
    +-----------+

9. Add to startup (optional)

 cp support-files/mysql.server /etc/init.d/mysql.server

Special note: MySQL officially recommends using the binary installation method. (The picture below is a screenshot of the official document)

Summarize

The above is a detailed tutorial on how to install MySQL 8.0 from CentOS 7.4 source code. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • How to install MySQL 8.0.13 in Alibaba Cloud CentOS 7
  • Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7
  • Tutorial on installing mysql8 on linux centos7
  • CentOS7.5 installation of MySQL8.0.19 tutorial detailed instructions
  • Tutorial diagram of installing mysql8.0.18 under linux (Centos7)
  • Detailed steps to install MYSQL8.0 on CentOS7.6
  • CentOS7 enables MySQL8 master-slave backup and daily scheduled full backup (recommended)
  • Installation tutorial of mysql8.0rpm on centos7
  • Centos7 installation of MySQL8 tutorial

<<:  Detailed explanation of asynchronous iterators in nodejs

>>:  WeChat applet + ECharts to achieve dynamic refresh process record

Recommend

Detailed explanation of Linux file permissions and group modification commands

In Linux, everything is a file (directories are a...

Detailed explanation of HTML programming tags and document structure

The purpose of using HTML to mark up content is t...

Detailed explanation of Docker usage under CentOS8

1. Installation of Docker under CentOS8 curl http...

Detailed steps for setting up and configuring nis domain services on Centos8

Table of contents Introduction to NIS Network env...

Solve the problem of yum installation error Protected multilib versions

Today, when installing nginx on the cloud server,...

JavaScript Advanced Closures Explained

Table of contents 1. The concept of closure Addit...

Add a copy code button code to the website code block pre tag

Referring to other more professional blog systems...

Share a Markdown editor based on Ace

I think editors are divided into two categories, ...

Detailed explanation of JavaScript program loop structure

Table of contents Select Structure Loop Structure...

The difference between JS pre-parsing and variable promotion in web interview

Table of contents What is pre-analysis? The diffe...

Detailed explanation of Mysql communication protocol

1.Mysql connection method To understand the MySQL...

Let's talk about destructuring in JS ES6

Overview es6 adds a new way to get specified elem...

Practical explanation of editing files, saving and exiting in linux

How to save and exit after editing a file in Linu...