php mysql 字符串 连接,使用PHP的MySQL连接字符串

I am trying to connect to the database that is hosted on my server through my local machine.

my server has cPanel 11, and it is a typical shared server, powered by CentOS, PHP and MySQL installed.

to be precise i am holding the reseller account in the same server. i want to access the database between different accounts or domains.

in MySQL connection String i tried defining the domain name, and it isn't working. here is what i tried.

$link = mysql_connect('mydomain.com', 'mysql_user', 'mysql_password');

if (!$link) {

die('Could not connect: ' . mysql_error());

}

echo 'Connected successfully';

mysql_close($link);

?>

this is giving the following error

Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://bhatkalnews.com:3306) in C:\wamp\www\test\conn.php on line 4

Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\wamp\www\test\conn.php on line 4

Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\test\conn.php on line 4

what do i have to define in connection string to make it work?

解决方案

Firewall ?

try

telnet mydomain.com 3306

on the command line.

If that doesn't work, the connection is blocked by a firewall, most likely

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值