1.查看远程连接设置的端口和mysql的端口是否匹配
2.如果是IDEA连接mysql,查看mysql-connector-java的版本是否符合mysql版本
3.开放防火墙
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
4.开放mysql远程访问权限
grant all privileges on *.* to 'username'@'your remote ip' identified by 'password' with grant option;
flush privileges;
第一行即授权用户username能够在your remote ip(远程ip)以密码password连接数据库。
若要设置为所有ip都可以登录,则将your remote ip设置为%即可
5.其他