OK I have researched every step and done as much as I could and still get the following error:
Error!: SQLSTATE[HY000] [2002] No connection could be made because
the target machine actively refused it.
(BTW this solution, PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused, does not relate, my problem refers to a connection to a remote mysql server, not a virtual machine, and changing to port 8888 or port 8889 has no effect on the message..)
Here is what I did:
I have created a remote connection in mysql:
GRANT ALL PRIVILEGES ON fin_sample.* to fin_test@'%' identified by '****';
I have changed
bind-address = 0.0.0.0
in/etc/mysql/mysql.conf.d/mysql.cnf
Confirmed I stopped and restarted mysql.
At this point the server should be accepting remote connections. Here is my code:
try {
$user = 'fin_test';
$pass = '****';
// Note "recommended" space after colon..
$dbh = new PDO('mysql: host=67.205.123.123;dbname=fin_test', $user, $pass);
foreach($dbh->query('SELECT * FROM fin_test.progview_sample') as $row) {
print_r($row);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
I am wondering how I debug this, or what is going wrong? I get the same response regardless of what input I use.