CentOS6.9中如何進(jìn)行二進(jìn)制方式安裝mysql5.7.21

今天就跟大家聊聊有關(guān)CentOS 6.9中如何進(jìn)行二進(jìn)制方式安裝MySQL5.7.21,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到榆社網(wǎng)站設(shè)計(jì)與榆社網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名注冊(cè)、虛擬空間、企業(yè)郵箱。業(yè)務(wù)覆蓋榆社地區(qū)。

前言

比 MySQL 5.6 快 3 倍,同時(shí)還提高了可用性,可管理性和安全性。一些重要的增強(qiáng)功能如下:

1.性能和可擴(kuò)展性:
    改進(jìn) InnoDB 的可擴(kuò)展性和臨時(shí)表的性能,從而實(shí)現(xiàn)更快的網(wǎng)絡(luò)和大數(shù)據(jù)加載等操作。
2.JSON支持:
    使用 MySQL 的 JSON 功能,你可以結(jié)合 NOSQL 的靈活和關(guān)系數(shù)據(jù)庫(kù)的強(qiáng)大。
3.改進(jìn)復(fù)制
    以提高可用性的性能。包括多源復(fù)制,多從線程增強(qiáng),在線 GTIDs,和增強(qiáng)的半同步復(fù)制。
4.性能模式
    提供更好的視角。我們?cè)黾恿嗽S多新的監(jiān)控功能,以減少空間和過(guò)載,使用新的 SYS 模式顯著提高易用性。
5.安全:
    我們貫徹“安全第一”的要求,許多 MySQL 5.7 新功能幫助用戶保證他們數(shù)據(jù)庫(kù)的安全。
6.優(yōu)化:
    我們重寫了大部分解析器,優(yōu)化器和成本模型。這提高了可維護(hù)性,可擴(kuò)展性和性能。
7.GIS: 
    MySQL 5.7 全新的功能,包括 InnoDB 空間索引,使用 Boost.Geometry,同時(shí)提高完整性和標(biāo)準(zhǔn)符合性。
實(shí)驗(yàn)環(huán)境:VMware Workstation Pro 14(試用版)

系統(tǒng)平臺(tái):
CentOS release 6.9 (Final)             內(nèi)核  2.6.32-696.el6.x86_64

1.去官網(wǎng)下載適合的二進(jìn)制包

https://dev.mysql.com/downloads/mysql/

CentOS 6.9中如何進(jìn)行二進(jìn)制方式安裝mysql5.7.21

mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

檢查系統(tǒng)內(nèi)是否安裝了數(shù)據(jù)庫(kù)。

#rpm -qa|grep MariaDB
#rpm -qa|grep mysql

2.創(chuàng)建用于啟動(dòng)mysql的賬號(hào)和組

#getent group mysql > /dev/null || groupadd mysql
#getent passwd mysql > /dev/null || useradd -g mysql -r -s /sbin/nologin mysql

3.解壓包至/usr/local

#tar xvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -C /usr/local/

4.創(chuàng)建軟鏈接mysql指向解壓后的目錄

#cd /usr/local/
#ln -s mysql-5.7.21-linux-glibc2.12-x86_64/ mysql

5.修改mysql文件夾所屬者和所屬組

#chown -R mysql.mysql mysql/

6.添加PATH至環(huán)境變量中

#echo 'PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile.d/mysql.sh

檢查文件
#cat /etc/profile.d/mysql.sh

加載環(huán)境變量文件 并檢查
#source /etc/profile.d/mysql.sh
#echo $PATH

7.創(chuàng)建數(shù)據(jù)庫(kù)存放文件夾和相關(guān)文件并修改權(quán)限

#mkdir -pv /data/mysqldb/3306/{logs,run,data}
#touch /data/mysqldb/3306/run/mysqld.pid
#touch /data/mysqldb/3306/logs/mysql-error.log
#chown -R mysql.mysql /data/mysqldb/
#chmod -R 770 /data/mysqldb

文件沒(méi)有創(chuàng)建的話,啟動(dòng)Mysql時(shí)將會(huì)報(bào)錯(cuò)

8.修改配置文件

#vim /etc/my.cnf

[client]  
port = 3306  
socket = /var/lib/mysql/mysql.sock    > 默認(rèn)就是在這里

[mysqld]  
user=mysql  
port = 3306  
socket=/var/lib/mysql/mysql.sock  
basedir =/usr/local/mysql
datadir =/data/mysqldb/3306/data 
pid-file=/data/mysqldb/3306/run/mysqld.pid 
log-error=/data/mysqldb/3306/logs/mysql-error.log

9.初始化數(shù)據(jù)庫(kù)

# cd /usr/local/mysql
# bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql --datadir=/data/mysqldb/3306/data

Mysql 5.7以后對(duì)密碼安全有更友好的提示了,
2018-03-03T15:16:23.708677Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

--initialize-insecure 以空密碼初始化數(shù)據(jù)庫(kù)
--initialize          隨機(jī)生成一個(gè)密碼并顯示在屏幕中,第一次登錄的時(shí)候必須提供此密碼。

10.復(fù)制啟動(dòng)服務(wù)腳本至/etc/init.d目錄

#cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

11.添加開(kāi)機(jī)啟動(dòng)

# chkconfig --add mysqld
# chkconfig mysqld on

#chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

12.啟動(dòng)mysql服務(wù)

#service mysqld start
Starting MySQL........                                     [  OK  ]

13.檢查確認(rèn)

檢查3306端口是否開(kāi)啟

#ss -ntl | grep 3306
LISTEN     0      50                        *:3306                     *:*

確認(rèn)版本

#mysql -V
mysql  Ver 14.14 Distrib 5.7.21, for linux-glibc2.12 (x86_64) using  EditLine wrapper

14.進(jìn)行安全配置

#/usr/local/mysql/bin/mysql_secure_installation

按提示操作即可
Press y|Y for Yes, any other key for No: y       > 沒(méi)有y就沒(méi)有下一步

There are three levels of password validation policy:                       > 列出密碼要求

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary 

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0                          > 選擇的數(shù)字,請(qǐng)參考上面的密碼要求
Please set the password for root here.

New password:                                                               > 設(shè)置密碼
Re-enter new password: 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y  > 更新密碼

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y    > 是否移除匿名登錄

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n   > 是否移除遠(yuǎn)程root登錄,生產(chǎn)環(huán)境請(qǐng)y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  > 是否移除test數(shù)據(jù)庫(kù),貌似二進(jìn)制安裝時(shí)并不包含test數(shù)據(jù)庫(kù)

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y   > 重新加載權(quán)限表,也就是立即生效。
Success. 

All done!

15.客戶端連接

#mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.21 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

至此,Mysql 5.7.21 二進(jìn)制方式安裝完畢,適合快速部署。

看完上述內(nèi)容,你們對(duì)CentOS 6.9中如何進(jìn)行二進(jìn)制方式安裝mysql5.7.21有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。

本文標(biāo)題:CentOS6.9中如何進(jìn)行二進(jìn)制方式安裝mysql5.7.21
URL分享:http://bm7419.com/article16/pssjdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、用戶體驗(yàn)、服務(wù)器托管網(wǎng)站制作、搜索引擎優(yōu)化網(wǎng)站營(yíng)銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)