1. 阿里云安全组端口开通 mysql portmysql
2. 数据库用户默认host是localhost, 修改%sql
mysql> select user, host from mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)
mysql> update mysql.user set host='%' where user = 'root' and host='localhost';数据库
mysql> FLUSH PRIVILEGES;安全
3. 可能须要这一步:session
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reloadtcp
作个记录,省得忘记。阿里云