在虚拟机里面安装mysql
Posted q2546
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在虚拟机里面安装mysql相关的知识,希望对你有一定的参考价值。
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
yum install mysql80-community-release-el7-3.noarch.rpm
cd /etc/yum.repos.d
修改mysql-community.repo
vi mysql-community.repo
修改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
[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
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 search mysql
安装
yum install mysql-community-server.x86_64
yum install mysql-community-server.x86_64
启动mysql
systemctl start mysqld
systemctl start mysqld
查看状态
systemctl status mysqld
systemctl status mysqld
设置开机启动
systemctl enable mysqld
systemctl enable mysqld
开放3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
用Windows的SQLyon连接Linux的Mysql
如报1130的错误,参考https://www.wangshenghua.com/d1412acdcf52c4490d61ef580d8422a9/
如报1130的错误,参考https://www.wangshenghua.com/d1412acdcf52c4490d61ef580d8422a9/
以上是关于在虚拟机里面安装mysql的主要内容,如果未能解决你的问题,请参考以下文章