Jump to content

How to connect mysql server in other web server


klpang

Recommended Posts

Dear All,

    I have a website need to connect a database in other webserver. In the scirpt, i put $sql = mysql_connect("xxx.xxx.xxx.xxx", "root", "xyzpassword") or die(mysql_error()) and the result is Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061). The webserver is in linux platfrom, at first i taught that is block by firewall. when i stop firewall service, the progarm still prompt same result. please advise.

 

 

 

Link to comment
Share on other sites

MySQL is probably rejecting external connections. This is something you will have to modify with the MySQL installation. Alternatively if this isn't the problem it's probably the MySQL user you have created.

GRANT ALL ON *.* FOR 'root'@'%'

 

HOWEVER, this is a warning, you are allowing external access to MySQL from the root user, this user has privileges to EVERYTHING, and thus is not a very clever nor secure thing to do.

 

Link to comment
Share on other sites

Thanks a lot. But still can't connect to database. already add port 3306 (tcp/udp) in iptables, still the same result.  Is there any way to connect.

 

For example

mysql_connect(publicaddress/domainname, "root", "password");

 

Result

Can't connect to MySQL server on 'publicaddress/domainname' (10061)

 

 

Please advise.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.