Query remote database question

cassembers

New Member
Hi guys... I'm wanting to add a new database connection to a remote server, but seem to be running into problems.
I have the database name, user and password right, but am not sure about the 'host'. I have tried it with the direct IP, the webaddress... and I always get a "can't connect to the database" when trying to create a new table or element or anything.

Basically I want to query information from a specific table from the remote database to display on the site... am I going about this the right way???
There has to be an easier way :( Help please!! :confused:
 
Hi,

It's happened to me once, I don't know how come, but fews minutes later that was connecting ok.
 
I have the database name, user and password right, but am not sure about the 'host'.

Did you try localhost? One sure fire way to check would be to pop open your configuration.php and look at the value for this line:

$mosConfig_host = 'localhost';


 
it isn't on the same server though... does that matter? The database is with a completely different host elsewhere that I own. So no.. I didn't try it because I figured localhost would mean it was on the same server... right?
I tried it... same issue.
Still am unable to connect using the servers direct IP...
 
Hi.

Just another note: what type of server are you talking about? (the remote server, I mean).
Most of the shared hosting servers that I know do NOT allow connections to mysql from other than "localhost" itself. So you *might* be stuck in something like this...

In order to try, you can create a .php file with:
Code:
<?php
   $dbhost = 'localhost';
   $dbuser = 'root';
   $dbpass = 'password';
   $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
           ('Error connecting to mysql');
?>

And run it from the same webserver where you are using Fabrik. If you cannot connect, then it's probably the problem I mentioned above.

edit: Just seen you reply. If you own the server, then you should know the answer :p
edit2: obviously, adjust username and password :p
 
Ok, so I mis-spoke... I don't OWN it... I rent it. :rolleyes:
Without digging deeper, I assume my problem is that it's not allowed and am not going to even attempt to delve deeper. haha.
Thank you for your advice!!
 
You almost certainly need to configure the remote server to allow connections. Most servers will only allow connections to MySQL from 'localhost', and you have to add remote permissions on a server by server basis.

Once you've added the actual port access, you may also ened to add specific permissions on the tables themselves, i.e. granting read permissions to 'some_user'@'other.server.your.domain'

If you have Cpanel, I'm pretty sure that has an option to add remote access. Then use phpMyAdmin to check the table permissions themselves.

If you don't have CPanel or can't work out how to do it, I'm sure you host support can work it out for you. And if not ... move to Liquid Web, who have the most awesome 24*7 tech support. :)

-- hugh
 
i concur with Hugh, you may also have to have a fixed ip address - I seem to remember needing that when I tried to do something similar
 
Hey guys.

I do have a static IP with my one host (one I'm trying to get the query from).. and I also do have Cpanel :)

I set remote access for the site.
Not quite sure what you you mean with the table permissions. I created a new user with select permissions only for the database and am using that to login with.
 
Hey guys.

I do have a static IP with my one host (one I'm trying to get the query from).. and I also do have Cpanel :)

I set remote access for the site.

I'm confused as to which site is which! By "one I'm trying to get the query from", do you mean the server making the query, or the server receiving the query? Your sentence could be read either way.

Not quite sure what you you mean with the table permissions. I created a new user with select permissions only for the database and am using that to login with.
So, if ServerA is the one you are making the query from, and ServerB is the one receiving the query:

ServerB needs the access control to allow ServerA to access to MySQL remotely. Usually done thru CPanel, or by modifying iptables rules by hand in Linux, or Windows firewall rules, whatever you need to do to get ServerA talking to the MySQL port on ServerA..

ServerB needs the user, specified as 'user'@'ServerB' (like 'joe'@'serverb.dome.domain.com' or 'Hugh'@'192.168.,50.3'), with sufficient permissions on the required table(s).

ServerA needs to use the 'user' name from ServerB to make the connection to ServerB, but without the @serverb part. Just the username.

NOTE - if the two servers are on entirely different networks (not hosted at the same site), it is possible, although unlikely that there is a firewall either preventing ServerA from talking outbound on MySQL's ports, or one on ServerB's network preventing inbound traffic. This is unlikely if you are using hosting providers, but a lot more likely if either of the servers is on a corporate network.

That's about all I can tell you. If it still doesn't work ... if you'd care to Subscribe, I can have a go at tracking this down for you (I'd need all kinds of access into both systems).

-- hugh
 
Ugh! What a mess LOL
I have a sneaky feeling there is a firewall involved here somewhere too, as I have run into it before.
This was supposed to be a 'quick fix' in the interm anyways, so I'll leave it at that. I'll just have to copy the information manually until my client gets their act in gear.
Sorry for wasting so much of your time - but thank you anyways!!
Cass
 
Oh, please don't think you are wasting anyone's time. That's what we are here for. There is just a limit to how far we can run with any given issue.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top