1

I have a 'test.php' on my webhost that sends the typical mysql_connect request to the database. When I access this test.php from my browser, connection is successful. I have the exact same test.php on my local box as well as EasyphpDev/Webserver. When I access test.php locally the return is: **Could not connect: No connection could be made because the target machine actively refused it. **

Test.php:

<?php
$link = mysql_connect('MyWebSite.ipagemysql.com', "databaseName","*password*");
if (!$link) { 
die('Could not connect: ' . mysql_error()); 
} 
echo 'Connected successfully'; 
mysql_select_db(blog_);
?>

For obvious reasons I substituted the first half of address etc. As I stated, test.php when accessed in it's location on my website works fine. Attempts from my local machine crap! I've checked my firewall and just to be 100%, I disabled it. Ive tryed different formats such as using remote IP instead of Domain etc, to no avail.

It seems that a connection is made however the error is [MACHINE] not [MYSQL] which indicates the response is not from MYSql correct? Thanks in advance!

Geekling
  • 23
  • 4
  • check bind-address setting on your db server...if it is fine...then check if port for mysql which default 3306 is open for you or not.... – Zafar Malik Mar 28 '16 at 06:16
  • The `mysql_*` functions in PHP are deprecated and shouldn't be used. Please read [Why shouldn't I use mysql_* functions in PHP?](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) for information on why and what to replace them with. – Matt Raines Mar 28 '16 at 07:05

1 Answers1

0

Please check if remote mysql is on in your hosting account. Basically the server where mysql is installed need to allow incoming connection to mysql port generalyl 3306 and also mysql user which you are trying to connect have been granted either a wild card % privilege or the ip which you are connecting with.

Update

As per this thread Host (iPage) does not allow remote access. So how can I reach/edit my database? your hosting company doesn't allow remote mysql so wont be able to access it, But you can still check with your hosting provider.

Community
  • 1
  • 1
Abhishek B
  • 148
  • 10
  • Aha! You are correct Abhishek! Shortly after posting here I took the next step and opened up a ticket with them. This information was very useful at any rate. So much for trying to make things a little simpler by testing from my machine. Thank you all! – Geekling Mar 28 '16 at 21:10