centos7 下安装 mysql5.6

一、官网下载 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;
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容