centos 一键安装官方 mysql

配置国内的yum源安装

一键安装mysql 5.6 数据库的yum源配置
添加清华大学的源,实现一键yum安装mysql数据库

cat >>/etc/yum.repos.d/mysql-community-56.repo<<EOF
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql56-community-el7/

# 不同的数据库版本,只需要更改这里的连接
# MySQL 5.7 centos 7 64 位的 
# https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/

#MySQL 5.6 centos 7 64 位的 
# https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.6-community-el7-x86_64/


enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
EOF

yum install -y mysql-community-server

 

 

通过使用官方的mysql rpm源

centos 7 

#一键安装 mysql 5.6
yum install -y http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm
yum install -y mysql-server

#一键安装 mysql 5.7
yum install -y http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm
yum install -y mysql-server
ps:注意安装后的默认密码

#一键安装 mysql 8 https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/
yum install -y mysql-server

 

centos 6 

跟centos通理,只是需要将el/7 -->改为el/6即可

#一键安装 mysql 5.6
yum install -y http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el7-5.noarch.rpm
yum install -y mysql-server

#一键安装 mysql 5.7
yum install -y http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql57-community-release-el7-10.noarch.rpm
yum install -y mysql-server
ps:注意安装后的默认密码

#一键安装 mysql 8
http://repo.mysql.com/yum/mysql-8.0-community/el/6/x86_64/mysql80-community-release-el7-2.noarch.rpm
yum install -y mysql-server

 

posted @ 2019-03-23 19:57  前海渔文乐  阅读(736)  评论(0编辑  收藏  举报