0

This is the first time i've come across this, i am trying to connect to mySQL Workbench on a windows server, using codeigniter. I get the following error.

Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'xx.xxx.xxx.xxx' (111)

So i tryed connecting using php via a simple connect script and i get the same error.

I thought maybe port 3306 was blocked , but my ISP said its not. Ive googles and found a few of the same issues that have happened to other people, but no proper solution can be found.

On Stackoverflow - Same Issue, thats not working

Simple connect :

$servername = "78.137.126.xxx;
$username = "root";
$password = "xxxxxx";


$conn = mysqli_connect($servername, $username, $password);


if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";

Even if i add the port to the above , the result does not change.

Community
  • 1
  • 1
Trifactor
  • 59
  • 9
  • 1
    MySQL is telling you that the connection to the server can't be made. It generally means that the server doesn't allow an incoming connection. It's not necessarily down to the port being blocked, so much as the server being bound to the localhost and therefore not listening on 3306. You will need to ask your web host (not ISP, unless they are the same) if the MySQL server allows connections in from the outside, or see if they will allow it. – gabe3886 Apr 13 '16 at 14:09
  • to add to @gabe3886, normally web host won't allow external connections to MySQL server as it is a security risk. try using ssh tunneling if you have ssh access. – bansi Apr 13 '16 at 14:16
  • show us your codes – Abdulla Nilam Apr 13 '16 at 15:08
  • I have my own Microsoft server , where i have installed mySQL Workbench , and setup a DB. And Yes sorry my ISP is my webhost company aswell.@Abdulla , i have added the connection above – Trifactor Apr 13 '16 at 15:23
  • Have you changed the `bind-address` directive in the `my.cnf` config file? To allow outside connections it should be `bind-address=sever-ip` where `server-ip` being the actual servers ip – dishrex Apr 13 '16 at 15:54
  • Hi @dishrex , i took a look at my my.cnf and strangley enough there is no bind-address set at the moment – Trifactor Apr 13 '16 at 16:32
  • Have you enabled remote connection on server ? – Arjun J Gowda Apr 13 '16 at 17:45

1 Answers1

0

It seems there was a block on my IP at my host. They told me that there was not , but there was.

Thanks for all the help anyways !

Trifactor
  • 59
  • 9