Cannot connect remote mysql, Cpanel?

Posted by BerkErarslan on Server Fault See other posts from Server Fault or by BerkErarslan
Published on 2012-11-29T23:54:48Z Indexed on 2012/11/30 5:08 UTC
Read the original article Hit count: 439

Filed under:
|
|

I use centos and cpanel

I need to use remote mysql with php.

I add the ip which I try connect to server to "Remote Database Access Hosts" on Cpanel.

However, when I try to connect server with this code:

 <?php
     $link = mysql_connect("server_ip", "xxx", "xxx") or
     die(mysql_error()); $db = mysql_select_db("xxx", $link) or die
     (mysql_error());  
     print_r($db);

I have error like this:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'xxxx' (10060) in C:\AppServ\www\test.php on line 3 Can't connect to MySQL server on '94.138.204.234' (10060)

I also try to connect using "server_ip:3306" but it still doesn't work.

How Can I solve this problem ?

© Server Fault or respective owner

Related posts about php

Related posts about mysql