Compiling and installing MySQL8.0

Source: Internet
Author: User
Tags bz2 mysql version

MySQL 8.0 official version 8.0.11 has been released, the official said MySQL 8 than MySQL 5.7 twice times faster, but also brought a lot of improvements and faster performance!

Note: Upgrading from MySQL 5.7 to MySQL 8.0 is only supported by using the In-place method and does not support downgrading from MySQL 8.0 to MySQL 5.7

(or downgrade from one MySQL version 8.0 to any earlier version of MySQL 8.0). The only supported alternative is to back up the data before the upgrade.


Operating System Description: CentOS 6.4

Database version: MySQL 8.0.0

I. Environmental preparedness

Yum Install Ncurses-devel-y

Yum Install Libaio-y

Yum Install glibc-devel.i686 glibc-devel-y

Yum install gcc gcc-c++-y

In addition, MySQL8.0 need to use GCC version of 4.8, and CentOS 6.4 through Yum can only be installed to 4.4.7, so you need to manually install a later version of GCC before installing mysql8.0, I take gcc-8.8.2 for example:

wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.gz

Tar XF gcc-4.8.2.tar.gz

CD gcc-4.8.2

# Load the dependent packages required for compilation:./contrib/download_prerequisites

./configure--prefix=/usr/local/gcc-4.8.2/--enable-bootstrap--enable-threads=posix--ENABLE-LANGUAGES=C,C++,OBJC , obj-c++

Make &&make Install

Description: Make takes a long time.

After installation, you also need to replace the original GCC environment with a new version of GCC, or MySQL will use the original GCC when installing:

mv/usr/bin/gcc/usr/bin/gcc447

mv/usr/bin/g++/usr/bin/g++447

Mv/usr/bin/c++/usr/bin/c++447

mv/usr/bin/cc/usr/bin/cc447

Ln-s/USR/LOCAL/GCC-4.8.2/BIN/GCC/USR/BIN/GCC

Ln-s/usr/local/gcc-4.8.2/bin/g++/usr/bin/g++

Ln-s/usr/local/gcc-4.8.2/bin/c++/usr/bin/c++

Ln-s/usr/local/gcc-4.8.2/bin/gcc/usr/bin/cc

Mv/usr/lib64/libstdc++.so.6/usr/lib64/libstdc++.so.6.bak

Ln-s/usr/local/gcc-4.8.2/lib64/libstdc++.so.6.0.18/usr/lib64/libstdc++.so.6

Solve the following problems:

Next, install the Boost library:

Wget-c http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.bz2--no-check-certificate

Tar XF Boost_1_60_0.tar.bz2\?r\=\&ts\=1479114685\&use_mirror\=ncu

CD Boost_1_60_0

./bootstrap.sh

./B2 Stage Threading=multi link=shared

./B2 Install Threading=multi link=shared

Two. Installing mysql8.0

# download and decompress MySQL

Wget-c http://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.0-dmr.tar.gz

Tar XF mysql-boost-8.0.0-dmr.tar.gz

# Compile and install MySQL

CD MYSQL-8.0.0-DMR

Cmake-dcmake_install_prefix=/usr/local/mysql \

-dmysql_datadir=/usr/local/mysql/data/-dsysconfdir=\etc\mysql \

-dwith_innobase_storage_engine=1 \

-dmysql_tcp_port=3306 \

-denabled_local_infile=1 \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \

-dwith_boost=/tmp/boost_1_60_0/

Make

Make install

# Add MySQL users and groups, and configure MySQL user permissions on the database directory

Groupadd MySQL

useradd-g MySQL MySQL

Chown Mysql.mysql/usr/local/mysql-r

# Initialize MySQL

Cd/usr/local/mysql

Bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/

Bin/mysql_ssl_rsa_setup

# configuration file

CP./SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF

Vim/etc/my.cnf

[Mysqld]

datadir=/usr/local/mysql/data/

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling Symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

Pid-file=/var/run/mysqld/mysqld.pid

Log-error=/var/log/mysqld.log

# Create process Files directory

Mkdir/var/run/mysqld

Chown mysql/var/run/mysqld/-R

# Set Environment variables

echo "Export path= $PATH:/usr/local/mysql/bin:/usr/local/mysql/sbin" >>/etc/profile

Source/etc/profile

# Set Boot startup script

Cd/usr/local/mysql

CP Support-files/mysql.server/etc/init.d/mysql.server

Chkconfig Mysql.server on

Service Mysql.server Start


Compiling and installing MySQL8.0

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.