首页 > 技术文章 > 在虚拟机里面安装mysql

q2546 2019-08-19 16:50 原文

https://dev.mysql.com/downloads/repo/yum/
首先到网站里面下载 mysql80-community-release-el7-3.noarch.rpm
通过xftp上传mysql80-community-release-el7-3.noarch.rpm到linux系统
安装仓库
yum install mysql80-community-release-el7-3.noarch.rpm

cd /etc/yum.repos.d
修改mysql-community.repo
vi mysql-community.repo
修改mysql-community.repo
# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
enabled=1   #原来是enabled=0,改成enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0    #原来是enabled=1,改成enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 
 
搜索MySQL
yum search mysql
安装
yum install mysql-community-server.x86_64
启动mysql
systemctl start mysqld
查看状态
systemctl status mysqld
设置开机启动
systemctl enable mysqld
开放3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
用Windows的SQLyon连接Linux的Mysql
如报1130的错误,参考https://www.wangshenghua.com/d1412acdcf52c4490d61ef580d8422a9/

推荐阅读