免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 7933 | 回复: 12
打印 上一主题 下一主题

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-06-22 11:03 |只看该作者 |倒序浏览
我用  mysql_connect("211.144.146.213","**","*******";
连接远程数据库,总是出现
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '211.144.146.213' (10061)
的无法连接提示。
但用 mysql_connect("localhost","root","123456";
连接本机的数据库却没有问题,该怎么才能连接上远程的数据库呢?谢谢各位解答一下。

论坛徽章:
0
2 [报告]
发表于 2005-06-22 12:23 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

我猜测你的my.cnf里skip-net被打开了.注释掉就行了.
你可以用netstat -nat看3306开了没有

论坛徽章:
0
3 [报告]
发表于 2005-06-22 12:57 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

my.cnf在哪里呢?
我用的是
mysql4.0.2+php5.0+apache2.0.5
netstat -n结果如下
          local address           foreign address         state
TCP    127.0.0.1:3306         127.0.0.1:4181         ESTABLISHED
TCP    127.0.0.1:3306         127.0.0.1:4182         ESTABLISHED
TCP    127.0.0.1:3654         127.0.0.1:3306         CLOSE_WAIT
TCP    127.0.0.1:4152         127.0.0.1:3306         CLOSE_WAIT
TCP    127.0.0.1:4181         127.0.0.1:3306         ESTABLISHED
TCP    127.0.0.1:4182         127.0.0.1:3306         ESTABLISHED

本地端口打开了。?
该怎么解决呢?谢谢

论坛徽章:
0
4 [报告]
发表于 2005-06-22 14:12 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

你看看/etc/my.cnf

论坛徽章:
0
5 [报告]
发表于 2005-06-22 14:13 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

你能把netstat -nat的结果都贴上来吗?
因为你发的只是联接好的那些联接

论坛徽章:
0
6 [报告]
发表于 2005-06-22 14:30 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

那就麻烦你了。。。谢谢

D:\mysql\bin>;netstat -a

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    billgates:http         billgates:0            LISTENING
  TCP    billgates:epmap        billgates:0            LISTENING
  TCP    billgates:microsoft-ds  billgates:0            LISTENING
  TCP    billgates:1025         billgates:0            LISTENING
  TCP    billgates:1028         billgates:0            LISTENING
  TCP    billgates:2869         billgates:0            LISTENING
  TCP    billgates:3031         billgates:0            LISTENING
  TCP    billgates:3032         billgates:0            LISTENING
  TCP    billgates:3057         billgates:0            LISTENING
  TCP    billgates:3058         billgates:0            LISTENING
  TCP    billgates:3074         billgates:0            LISTENING
  TCP    billgates:3124         billgates:0            LISTENING
  TCP    billgates:3206         billgates:0            LISTENING
  TCP    billgates:3306         billgates:0            LISTENING
  TCP    billgates:3389         billgates:0            LISTENING
  TCP    billgates:3654         billgates:0            LISTENING
  TCP    billgates:4152         billgates:0            LISTENING
  TCP    billgates:4181         billgates:0            LISTENING
  TCP    billgates:4182         billgates:0            LISTENING
  TCP    billgates:4493         billgates:0            LISTENING
  TCP    billgates:5000         billgates:0            LISTENING
  TCP    billgates:3001         billgates:0            LISTENING
  TCP    billgates:3002         billgates:0            LISTENING
  TCP    billgates:3003         billgates:0            LISTENING
  TCP    billgates:3010         billgates:0            LISTENING
  TCP    billgates:3010         billgates:3057         ESTABLISHED
  TCP    billgates:3011         billgates:0            LISTENING
  TCP    billgates:3031         billgates:3010         CLOSE_WAIT
  TCP    billgates:3032         billgates:3010         CLOSE_WAIT
  TCP    billgates:3057         billgates:3010         ESTABLISHED
  TCP    billgates:3074         billgates:3010         CLOSE_WAIT
  TCP    billgates:3119         billgates:3306         TIME_WAIT
  TCP    billgates:3306         billgates:4181         ESTABLISHED
  TCP    billgates:3306         billgates:4182         ESTABLISHED
  TCP    billgates:3654         billgates:3306         CLOSE_WAIT
  TCP    billgates:4152         billgates:3306         CLOSE_WAIT
  TCP    billgates:4181         billgates:3306         ESTABLISHED
  TCP    billgates:4182         billgates:3306         ESTABLISHED
  TCP    billgates:4493         billgates:3010         CLOSE_WAIT
  TCP    billgates:netbios-ssn  billgates:0            LISTENING
  TCP    billgates:3058         baym-cs90.msgr.hotmail.com:1863  ESTABLISHED
  TCP    billgates:3124         211.144.146.213:22     ESTABLISHED
  TCP    billgates:3206         211.144.146.213:22     ESTABLISHED
  UDP    billgates:epmap        *:*
  UDP    billgates:microsoft-ds  *:*
  UDP    billgates:isakmp       *:*
  UDP    billgates:1026         *:*
  UDP    billgates:1027         *:*
  UDP    billgates:3004         *:*
  UDP    billgates:3067         *:*
  UDP    billgates:3629         *:*
  UDP    billgates:4000         *:*
  UDP    billgates:4551         *:*
  UDP    billgates:4552         *:*
  UDP    billgates:6000         *:*
  UDP    billgates:6001         *:*
  UDP    billgates:6002         *:*
  UDP    billgates:6003         *:*
  UDP    billgates:ntp          *:*
  UDP    billgates:1900         *:*
  UDP    billgates:3005         *:*
  UDP    billgates:3016         *:*
  UDP    billgates:3059         *:*
  UDP    billgates:3122         *:*
  UDP    billgates:3127         *:*
  UDP    billgates:3137         *:*
  UDP    billgates:3628         *:*
  UDP    billgates:4341         *:*
  UDP    billgates:4916         *:*
  UDP    billgates:domain       *:*
  UDP    billgates:bootps       *:*
  UDP    billgates:bootpc       *:*
  UDP    billgates:ntp          *:*
  UDP    billgates:netbios-ns   *:*
  UDP    billgates:netbios-dgm  *:*
  UDP    billgates:1900         *:*
  UDP    billgates:discard      *:*
  UDP    billgates:ntp          *:*
  UDP    billgates:1900         *:*

D:\mysql\bin>;

就这些啦。。。

论坛徽章:
0
7 [报告]
发表于 2005-06-22 14:52 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

冒昧的再问一下。etc/my.cnf在哪里?
我在c盘d盘都搜索遍了也没发现啊
我用的是mysql4.0.2+php5.0+apache2.0.5
太麻烦你了。。。

论坛徽章:
0
8 [报告]
发表于 2005-06-22 17:04 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

看起来你的3306是开着的.我以为你是linux系统.windows系统下的配置文件在那里我不太清楚.
你现在测试一下在别的机器下用
msyql -h host -p 3306 -u user -p
联接数据库服务器,看有什么反映

论坛徽章:
0
9 [报告]
发表于 2005-06-22 17:40 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

谢谢这么不厌其烦的回答我的问题。
可是我这里就我一台有mysql,服务器端时linux。
我可以通过secureCAT登录服务器,也有读写的权限。
实在不行我去问问服务器那边的人吧,也许是那里的问题。。
再次感谢。。。

论坛徽章:
0
10 [报告]
发表于 2005-06-22 19:03 |只看该作者

请问如何用mysql_connect连接远程数据库呢?谢谢各位。。

加一条记录,允许root通过外部IP来访问即可。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP