第一步:安装从网上下载文件的wget命令
[[email protected] ~]# yum -y install wget
第二步:下载mysql的repo源
[[email protected] ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
第三步:安装mysql-community-release-el7-5.noarch.rpm包
[[email protected] ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
第四步:查看下
[[email protected] ~]# ls -1 /etc/yum.repos.d/mysql-community* /etc/yum.repos.d/mysql-community.repo /etc/yum.repos.d/mysql-community-source.repo
会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
第五步:安装mysql
[[email protected] ~]# yum install mysql-server
# 启动mysql服务
service mysql start
# 使用初始密码登录mysql服务 并修改密码
mysql -uroot -p
alter user ‘root‘@‘localhost‘ identified by ‘root‘;
flush privileges;