1. 下载mysql的repo源
如果没有 wget 先yum install -y wget
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. 安装mysql-community-release-el7-5.noarch.rpm包
非 root 用户 加上 sudo
$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. 安装mysql
$ yum install -y mysql-server
4. 启动mysql
$ service mysqld start
5. 进入mysql and 修改 mysql 密码
$ mysql
$ UPDATE mysql.user SET password=PASSWORD("your password") WHERE user="root" AND Host="localhost";