wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
執行完成後會在/etc/yum.repos.d/
目錄下生成兩個repo文件mysql-community.repo
mysql-community-source.repo
mysql
yum clean all yum makecache
yum install mysql-community-client.x86_64 mysql-community-common.x86_64 mysql-community-devel.x86_64 mysql-community-libs.x86_64 mysql-community-server.x86_64
或者sql
rpm install mysql-server
service mysqld start
grep 'temporary password' /var/log/mysqld.log
獲得以下內容:緩存
2016-10-28T10:36:32.369073Z 1 [Note] A temporary password is generated for root@localhost: 5Oazqgpiat!p
mysql -u root -p //回車,而後輸入上一步查到的初始密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; //如今的mysql對密碼強度要求較高,須要包含大小寫字母、數字和特殊字符
至此,mysql-server安裝完成code