Jump to content

Recommended Posts

I would like to run a script on one server to access the mysql database on another server (both I own).  For example I want to run a script on my laptop that will read data from the mysql database on my home computer running apache 2.2  I am using dyndns to ensure I am always able to get to the computer.  I have gone to the www.mypage.org and can run the scripts on that site (my computer)  but the scripts on that computer are set for localhost as the domain.  When I set the config up on my computer I use

define("DB_SERVER", "localhost");

define("DB_USER", "fakeusername");

define("DB_PASS", "fakepassword");

define("DB_NAME", "fakedatabase");

 

When I set up the laptop I use:

 

define("DB_SERVER", "mypage.org");

define("DB_USER", "fakeusername");

define("DB_PASS", "fakepassword");

define("DB_NAME", "fakedatabase");

 

Is there something different I need to do in the PHP, the Mysql or the apachie?

If you can reach the web server from a remote location, you should probably be able to reach the mysql server from a remote location. Try the following (assuming you are using the default port number for you mysql server) -

 

define("DB_SERVER", "mypage.org:3306");

I tried that but still get the same error.  Do I need to set up a virtual server on my apache?  Right now I just have the basic install, then have dyndns sent requests directed to my current IP.  sorry, I"m a bit of a newb to this stuff, but I appreciate all the help you guys give.

I tried that but still get the same error.

 

Until you post the error, no one can help you with what the problem is. xxxxxx out any sensitive information in the error message, but you have got to provide the relative information you know about the problem. There are at least a dozen different things that could prevent a remote connection from working.

The error I get is;

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'xxxxxx.org' (10061) in C:\xampp\htdocs\cows\cowboy.php on line 6

Can't connect to MySQL server on 'xxxxx.org' (10061)

Hi,

There error code indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server.  Also check the firewall.

 

Thanks

Stu

I think I am getting closer; I found some info that tells me I have to config mysql to allow tcp/ip  I tried it but it caused scripts that were running before to crash; I think however this is because I have those looking to localhost since they are on the local host.  I might try hardcoding those systems to the server name and see how that goes.

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.