linux MySQL 5.7.27安装

step:1 打开官网

打开官网首页https://www.mysql.com,点击导航菜单 DOWNLOADS,找到社区版

setp:2 选择yum安装方式,点击 快速安装指导

step:3 安装rpm安装工具

rpm -ivh mysql80-community-release-el6-3.noarch.rpm

step:4

yum repolist all | grep mysql

关闭8.0版本 sudo yum-config-manager –disable mysql80-community

打开5.7版本 sudo yum-config-manager –enable mysql57-community

查看设置情况 yum repolist enabled | grep mysql

step: 5 初始化MySQL

sudo yum -y install mysql-community-server mysql-client

启动MySQL服务 sudo service mysqld start

查看MySQL状态 sudo service mysqld status

step: 6 初始化mysql密码

获取生成的随机密码 sudo grep ‘temporary password’ /var/log/mysqld.log

登录MySQL mysql -u root -p

修改密码 ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘NewPassword!’;