長話短說:html
step1:下載mysql源安裝包:wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpmmysql
step2:安裝MySQL源:yum localinstall mysql57-community-release-el7-8.noarch.rpmsql
step3:檢測是否安裝完成:yum repolist enabled | grep "mysql.*-community.*"安全
step4:安裝mysql:yum install mysql-community-serveride
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 '您的新密碼'
3d
step9:設置mysql可以遠程訪問:
登陸進MySQL:mysql -uroot -p密碼
增長一個用戶給予訪問權限:grant all privileges on *.* to '用戶名'@'ip地址' identified by '密碼' with grant option; //可將ip改成%%,表示開啓全部的rest
注意這裏須要再阿里雲安全組中開放3306端口供公網訪問。詳情可參考本人博客:https://www.cnblogs.com/funnyboy0128/p/7966531.html
完成以上步驟,在公網經過工具鏈接測試便可。