美文网首页
centos7 下安装 mysql5.6

centos7 下安装 mysql5.6

作者: 流月汐志 | 来源:发表于2019-11-19 14:17 被阅读0次

一、官网下载 yum 源

https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm

二、安装 yum 源

yum install mysql80-community-release-el7-3.noarch.rpm

三、修改 yum 源

vim /etc/yum.repos.d/mysql-community.repo
# 把 mysql56 的 enabled 改为 1
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# 把 mysql80 的 enabled 改为 0
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

四、安装 mysql-community-server

yum install  mysql-community-server

四、启动 mysqld

[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl status mysqld.service

五、一些命令

mysql> create user 'root'@'%' identified by 'xxx';
mysql> grant all privileges on *.* to 'root'@'%' identified by 'xxx' with grant options;
mysql> update mysql.user set password=PASSWORD('mysqlgnnt') where user='root';
mysql> flush privileges;

相关文章

网友评论

      本文标题:centos7 下安装 mysql5.6

      本文链接:https://www.haomeiwen.com/subject/bejwictx.html