打开防火墙3306端口

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

或者禁用防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

修改MySQL远程连接设置

mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; 
FLUSH PRIVILEGES;
EXIT