码迷,mamicode.com
首页 > 数据库 > 详细

Centos7使用yum命令安装Mysql

时间:2018-01-19 00:13:55      阅读:239      评论:0      收藏:0      [点我收藏+]

标签: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 Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=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

标签:rect   理解   tps   zone   ref   linux   doc   lan   its   

原文地址:https://www.cnblogs.com/xxoome/p/8313453.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!