# 安装mysql
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
# 启动mysql
systemctl start mysqld
# 查看临时密码
grep "password" /var/log/mysqld.log
# 登录mysql
mysql -u root -p
# 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your new password';
# 按需开启远程访问
grant all privileges on *.* to 'root'@'%' identified by 'YOUR PASSWORD' with grant option;
# 刷新
flush privileges;
# 按需修改端口