长话短说:
step1:下载mysql源安装包:wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
step2:安装MySQL源:yum localinstall mysql57-community-release-el7-8.noarch.rpm
step3:检测是否安装完成:yum repolist enabled | grep "mysql.*-community.*"
step4:安装mysql:yum install mysql-community-server
step5:设置开启启动mysql服务:systemctl enable mysqld
step6:启动MySQL服务:systemctl restart mysqld
step7:查看MySQL初始密码:grep 'A temporary password' /var/log/mysqld.log
step8:更改MySQL密码:mysqladmin -u root -p'step7中的就密码' password '您的新密码'
step9:设置mysql能够远程访问:
登录进MySQL:mysql -uroot -p密码
增加一个用户给予访问权限:grant all privileges on *.* to '用户名'@'ip地址' identified by '密码' with grant option; //可将ip改为%%,表示开启所有的
注意这里需要再阿里云安全组中开放3306端口供公网访问。详情可参考本人博客:https://www.cnblogs.com/funnyboy0128/p/7966531.html
完成以上步骤,在公网通过工具连接测试即可。