0

I have two hosts

  • web host ( A server )
  • database server ( B server )

Connection between them is not stable. I don't believe it is connectivity via servers problem, because I can reach that database and website anytime I want from my local device. What could be wrong?

Specification:

  • MySQL 5.5.52 ( B server )
  • CodeIgniter 3.1.0 ( A server )

What was done:

  • Opened port for MySQL in B server;
  • Granted full privileges for user to connect from A server IP to database;
  • Edited my.cnf file - added B Server's external IP (in config value: bind-address)

Error Msg;

A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): (HY000/2003): Can't connect to MySQL server on 'IP' (4)

Drew
  • 24,851
  • 10
  • 43
  • 78
  • what does not stable mean – Drew Oct 14 '16 at 06:13
  • One time it works, one time it says that can't connect to database – Paulius Butkus Oct 14 '16 at 06:16
  • well show the actual error message you receive from the server – Drew Oct 14 '16 at 06:17
  • A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): (HY000/2003): Can't connect to MySQL server on '*IP*' (4) Filename: mysqli/mysqli_driver.php I just simply selecting value, one time it returns result, one time it returns that error. – Paulius Butkus Oct 14 '16 at 06:24
  • please see [1](http://stackoverflow.com/q/35852956/1816093) , [2](http://stackoverflow.com/q/35126910/1816093) , [3](http://stackoverflow.com/q/35255709/1816093) , – Drew Oct 14 '16 at 06:39
  • My database configurations are okey, because I can simply connect from my local device. Done everything like in 1st link. – Paulius Butkus Oct 14 '16 at 06:44
  • Also, find out that it's like period of time (like timeout), after which I try to run select sentence and it runs without error, but after page refresh same error displays (just like, when I try to run that sentence twice, sometimes three, four times, it fails) – Paulius Butkus Oct 14 '16 at 07:24

0 Answers0