CentOS7.4 source code compile and install MySQL8.0

MySQL 8 The official version 8.0.11 has been released. Officially, MySQL 8 is 2 times faster than MySQL 5.7, and it also 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 a long time.

  1. Environment

CentOS7.4 64-bit minimal installation

  1. Preparation

  2. Installation dependencies

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

  1. Download source package

http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-boost-8.0.11.tar.gz (This version has With boost)

  1. Create mysql user

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

  1. Create installation directory and data directory

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

Three. Install MySQL8.0.11

  1. Unzip the source package

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

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

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

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

  1. initialization

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

  1. Start mysql

bin/mysqld_safe --user=mysql &

  1. Modify 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 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)

  1. Create soft link (not necessary)

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     |
+-----------+

  1. Add to startup (not necessary)

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

Hereby explain: MySQL officially recommends binary installation. (The picture below is a screenshot of the official document)

This article will permanently update the link address: https://www.linuxidc.com/Linux/2018-04/152010.htm

Recommended Posts

CentOS7.4 source code compile and install MySQL8.0
Ubuntu 18.04 source code compile and install ffmpeg4.1
Install MySQL 8.x from source code under CentOS7
Centos compile and install Git
Centos compile JDK8 source code
Centos7 compile and install ntp-4.2.8p11
CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
Centos compile and install LAMP (apache-2.4.7 + mysql-5.5.35 + php 5.5.8) + Redis
CentOS7 yum install and start mysql
Compile and install LAMP under Centos 5.2
CentOS7 compile and install L(A|N)MP environment
CentOS7 yum install and start mysql
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Compile FFMPEG source code under CentOS7
Linux CentOS6 compile and install Pyt
CentOS7.2 install Mysql5.7.13
CentOS install mysql
CentOS8 install MySQL8.0
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
Compile and install the open source EDA tool-Surelog on CentOS8
Compile and install libmodbus library under CentOS7
Compile and install nodejs and yum in Centos8
CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
Install centos7 and connect
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
CentOS 7.2 Yum install MySQL 5.6
Centos7 install Mysql8 tutorial
Install mysql under Centos 7
Centos7 install Mysql database
Install mysql5.1 under CentOS6.5
How to install openssh from centos 7 source code
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
Centos6.5 compile and install LNMP architecture web environment
Centos7.2 compile and install way to build phpMyAdmin
How to compile and install xdebug from source code in Ubuntu environment
Install mysql online on centos
centos7 install python3 and ipython
Centos mysql installation and configuration
Know Linux and install CentOS
centos install mysql through yum
CentOS 7 install Mono and MonoDevelop
Ubuntu 16.04 compile and install PHP 7.2
ubuntu18.04 compile and install python3.8
CentOS6.5 install Java 8 and Tomcat8
Install MySQL 8.0.16 on Linux Centos
Install MySQL under Linux (CentOS 7)
Centos6.5 install and configure mongodb
CentOS7 install python3 and pip3
CentOS7 install OracleJDK and JRE
CentOS6.5 install Java 8 and Tomcat8
Centos6 install mysql 5.7.x series
CentOS6 install and crack Jira 7
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack confluence
Compile and install Lnmp shell script under Linux centos
CentOS6 install and crack Jira 7
CentOS8 install MySQL8 (pro test)
Centos 7 install jdk and package service service