Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Compile and install MySQL8.0

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL 8.0 official version 8.0.11 has been released, and officials say MySQL 8 is twice as fast as MySQL 5.7. it also brings a lot of improvements and faster performance!

Note: upgrading from MySQL 5.7to MySQL 8.0only supports upgrading using in-place, and downgrading from MySQL 8.0to MySQL 5.7is not supported.

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

Operating system description: CentOS 6.4

Database version: MySQL 8.0.0

one。 Environmental preparation

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 needs to use gcc version 4.8 or above, while centos 6.4 can only be installed to 4.4.7 through yum, so you need to manually install a higher version of gcc before installing mysql8.0. Let me take gcc-8.8.2 as an 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

# 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 will take a long time.

After installation, you also need to replace the original gcc environment with the new version of gcc, otherwise mysql will still be installed with the original gcc:

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。 Install mysql8.0

# download and extract 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 the permissions of mysql users to 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 a process file 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 script

Cd / usr/local/mysql

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

Chkconfig mysql.server on

Service mysql.server start

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report