Installing MySQL on Linux Using the MySQL Yum Repository
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html
1 下载MySQL epel源
https://dev.mysql.com/downloads/repo/yum/
选择你想要的版本
For an EL6-based system, the command is in the form of:
安装epel源
shell> sudo yum localinstall mysql57-community-release-el6-{version-number}.noarch.rpm
For an EL7-based system:
shell> sudo yum localinstall mysql57-community-release-el7-{version-number}.noarch.rpm
安装mysql
shell> sudo yum install mysql-community-server
启动mysql
sudo service mysqld start
查看密码
shell> sudo grep 'temporary password' /var/log/mysqld.log
修改密码
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';