1)前往用户根目录
#切换到家路径
cd ~
2)下载mysql 5.7
# 下载mysql 5.7的rpm包
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
3)安装mysql 5.7
# 安装mysql(mysql57-community-release-el7-10.noarch.rpm刚刚下载代表文件名字)
yum -y install mysql57-community-release-el7-10.noarch.rpm
# 安装mysql的社区版
yum -y install mysql-community-server
4)启动mysql57并查看启动状态
systemctl start mysqld.service # 启动mysql服务
systemctl status mysqld.service # 查看mysql服务的启动状态
5)查看mysql客户端的root用户默认密码并登录
grep "password" /var/log/mysqld.log # 查看随机生成的密码是什么
# 比如说是:+wVhgBTpI1a0
mysql -uroot -p # mysql客户端登录连接服务端
6)修改密码,登录进去之后必须要先修改密码才能查看show databases;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yang123?';