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. 啟動(dòng)mysql
$ service mysqld start
5. 進(jìn)入mysql and 修改 mysql 密碼
$ mysql
$ UPDATE mysql.user SET password=PASSWORD("your password") WHERE user="root" AND Host="localhost";