Access MySQL hosted elsewhere from x10hosting script

Status
Not open for further replies.

narvin

New Member
Messages
8
Reaction score
0
Points
0
I am trying to access a MySQL server that is NOT running on x10hosting.com from a script that is running on x10hosting.com. I am able to successfully connect to this database from scripts not run on x10, so I know that the database is configured correctly. I use the following code on scripts, which doesn't work on x10 scripts, but does work on other sites:

<?php
$link = mysql_connect('xxx.xxx.xxx.xxx', 'dbuser', 'dbpassword');
?>

I have also tried the following variation:

<?php
$link = mysql_connect('xxx.xxx.xxx.xxx:3306', 'dbuser', 'dbpassword');
?>

I realize that x10 may disallow remote access to databases hosted on your servers for security reasons. But why can't I connect to remote db's not hosted on your servers?

Incidentally, the motivation for using a database not hosted by x10 is because 1) one of my databases had all the tables deleted, even though it still shows that it has 5 tables in phpmyadmin, and 2) phpmyadmin has been running very slooowly the last 3 days or so.
 
Last edited:

narvin

New Member
Messages
8
Reaction score
0
Points
0
I would NOT want to use localhost as the host because, and I thought I was pretty clear about this, the database is not local to x10. It resides somewhere else, hence the ip address 'xxx.xxx.xxx.xxx'.
 

Danielx386

Member
Messages
712
Reaction score
9
Points
18
maybe it (the remote server) don't allow people to make connection from other servers
 

narvin

New Member
Messages
8
Reaction score
0
Points
0
Again, I thought I was pretty clear about this. I already verified that the db server does in fact accept connections from remote hosts. It's just not accepting (or receiving) a connection from my x10 script.

Thanks for all the quick replies, by the way.
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
I would NOT want to use localhost as the host because, and I thought I was pretty clear about this, the database is not local to x10. It resides somewhere else, hence the ip address 'xxx.xxx.xxx.xxx'.

my bad,
I hate this stuff too, i am just such a hypocrite, it what happens when you're tired.
 

narvin

New Member
Messages
8
Reaction score
0
Points
0
No prob. But now thanks to you, I know why phpmyadmin has been so slow:)
Edit:
In fact, I'll give you the db info so you can try connecting to it yourselves. (I hope this isn't bad form.)

host: 69.122.122.147
port: 3306 (for now)
user: x10hosting
password: password

<?php
$link = mysql_connect('69.122.122.147', 'x10hosting', 'password');
?>

I just thought of something... I'm hosting the db from my home comp. My ISP blocks port 80, so if I want to run apache, I have to use some other port. Maybe they also block port 3306, in which case I should try configuring the db to listen on another port. The remote script that I tested that worked was on a different IP than the db, but it was the same ISP, so maybe that's why it worked.
 
Last edited:

narvin

New Member
Messages
8
Reaction score
0
Points
0
Well, it wasn't the port being blocked by the ISP, because I tried a different port and that didn't work either.

It's not a firewall thing because I have already connected to this db from a remote computer. I just can't connect to it from the x10 server that my script is running off of.
 

Danielx386

Member
Messages
712
Reaction score
9
Points
18
ok, i'm thinking that x10 got some issue here with their firewall or something.
 

narvin

New Member
Messages
8
Reaction score
0
Points
0
Okay, I've made a php script and have hosted on three hosts:

x10hosting.com: http://narvin.x10hosting.com/remotedb.php
zymic.com: http://narvin.zxq.net
100mb.com: http://narvin.110mb.com

It attempts to connect to the database using the provided hostname (and port if you want to do host:port), user name and password. As we can see, we can not connect from an x10 or zymic script. But the 100mb script works fine. The code for all three pages is exactly the same. So, it looks like the problem is on x10's end. Can you guys resolve this? Or tell me why it's happening?

Here is the php portion of the code:

<?php
if(isset($_REQUEST['host'])) {
echo 'Attempting to connect to ' . $_REQUEST['user'] . '@' . $_REQUEST['host'] . ' using password ' . $_REQUEST['pwd'] . '...<br>';
$link = @mysql_connect($_REQUEST['host'], $_REQUEST['user'], $_REQUEST['pwd']);
if(is_resource($link)) echo 'SUCCESS: connected to MySQL server<br>';
else echo 'FAILURE: could not connect to MySQL server<br>';
}
?>
 
Last edited:

Smith6612

I ate all of the x10Pizza
Community Support
Messages
6,517
Reaction score
48
Points
48
It is an issue with the firewall configuration on the server. At the moment the firewall is purposely set to block Remote SQL to other servers not x10. Corey or another admin who has say over these things should be able to see this post soon and answer. This has been a feature many have been asking about.
 
Status
Not open for further replies.
Top