第一,首先能ping通mysql数据库所在的主机。
第二,telnet mysql数据库的端口号 。如果不行,要在防火墙,高级设置里面,配置入站规则;开放3306端口。
第三,如果还不行,结合下面两个网址
http://blog.csdn.net/a19881029/article/details/50805562
,总结如下:
第一步:
mysql服务没问题:
- sean@sean:~$ ps -ef|grep mysqld
- mysql 1219 1 0 21:09 ? 00:00:01 /usr/sbin/mysqld
- sean 10373 9602 0 21:38 pts/7 00:00:00 grep --color=auto mysqld
并且本地的登录也能成功:
- sean@sean:~$ mysql -u root -h 127.0.0.1
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 40
- Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
- Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.