在华为云服务器上安装了mysql , 远程不能连接。
step1 : 确保mysql server 启动
step2:华为云服务器设置安全组,入方向开放3306端口
step3:服务器开发3306
CentOs7以下开启方式
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
iptables save
service iptables restart
CnetOs7开启方式
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload
step4:
grant all privileges on *.* to 'root'@'%' identified by 'root用户的密码';
flush privileges;
use mysql;
select user,host from user;
+------+---------------------+
| user | host |
+------+---------------------+
| root | % |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
% 表示可以被任何机器访问