Centos7使用yum命令安裝Mysql

來源:互聯網
上載者:User

標籤:rect   理解   tps   zone   ref   linux   doc   lan   its   

首先:具體的安裝步驟在mysql官方文檔上都有詳細的描述。

這裡造輪子是讓自己加深理解。

官方文檔地址:https://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html

目前mysql最新版本為:5.7.x

因為5.7版本比之前版本改動比較大,項目中一般還是在用5.6版本。

1、Adding the MySQL Yum Repository

  Go to the Download MySQL Yum Repository page (http://dev.mysql.com/downloads/repo/yum/) in the MySQL Developer Zone.

  因為centos版本是7.x,至於為什麼是mysql57-community-release-el7-11.noarch.rpm,文檔中有如下解釋:

  The repository packages available below will provide MySQL Server 5.7 by default. Other versions can be obtained by editing the repo setup file installed by the package. 

 

yum localinstall mysql57-community-release-el7-11.noarch.rpm

 

You can check that the MySQL Yum repository has been successfully added by the following command:

yum repolist enabled | grep "mysql.*-community.*"

 

Selecting a Release Series

vim /etc/yum.repos.d/mysql-community.repo

# Specify enabled=0 to disable a subrepository,or enabled=1 to enable a subrepository.# Enable to use MySQL 5.6[mysql56-community]name=MySQL 5.6 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

You should only enable subrepository for one release series at any time. When subrepositories for more than one release series are enabled, the latest series will be used by Yum.

 

Verify that the correct subrepositories have been enabled and disabled by running the following command and checking its output:

yum repolist enabled | grep mysql

 

2、Install MySQL by the following command:

yum install mysql-community-server

 

Start the MySQL server with the following command:

systemctl start mysqld.service

 

Check the status of the MySQL server with the following command:

systemctl status mysqld.service

 

  

 

Centos7使用yum命令安裝Mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.