CentOS7.4下MySQL5.7.28源碼方式安裝

Linux系統版本:CentOS7.4
MySQL版本:5.7.28
在Linux平臺有RPM包、二進制包、源碼包3中安裝方式,這一篇文章主要是以源碼包爲例來介紹如何在Linux平臺下進行MySQL的安裝。
下載地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.28.tar.gz
國內鏡像:http://mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-boost-5.7.28.tar.gz
具體安裝步驟以下:
(1)首先卸載mariadb,否則後面會和安裝mysql須要的庫衝突:node

[root@localhost ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

(2)建立mysql用戶和用戶組:mysql

[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -r -g mysql -s /bin/false mysql

(3)建立MySQL安裝目錄和data目錄:c++

[root@localhost ~]# mkdir /opt/mysql
[root@localhost ~]# mkdir -p /data/mysql
[root@localhost ~]# chown -R mysql:mysql /opt/mysql
[root@localhost ~]# chown -R mysql:mysql /data/mysql

(4)安裝相關依賴:sql

[root@localhost ~]#yum install -y cmake make gcc gcc-c++ ncurses-devel  openssl-devel

(4)編譯安裝:ide

[root@localhost ~]# tar -xvf mysql-boost-5.7.28.tar.gz
[root@localhost mysql-5.7.28]# cmake \
-DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DMYSQL_USER=mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 -DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/root/mysql-5.7.28/boost/boost_1_59_0/ \
-DMYSQL_DATADIR=/data/mysql \
-DWITH_SSL=system
[root@localhost ~]#make && make install
相關文章
相關標籤/搜索