# 下载
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
# 安装
yum install -y mysql-community-server
# 启动
systemctl start mysqld
systemctl enable mysqld
# 修改密码
#5.7会默认生成密码,查看密码(复制一下密码,登录时可以粘贴)
grep 'temporary password' /var/log/mysqld.log
# 登录(登录后不修改密码,视乎不让执行其它sql)
mysql -uroot -p
# 修改密码(得设置复杂点,不然不给过)
SET PASSWORD = PASSWORD('Admin123!');
# 开放外网访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Admin123!' WITH GRANT OPTION;
flush privileges;
# 退出mysql命令行后开启端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload