1

I have tried to connect to Amazon EC2 instance MySql from localhost.

Tried:

  • Granting privilege for user for remote connect

  • Made domain ping-able from outside.

  • Able to login through phpmyadmin with same credentials

  • Gone through lot of Stackoverflow answers.

$link = mysqli_connect('ec2-12-223-36-172.compute-1.amazonaws.com', 'myuser', 'xxxxxxxxxxx');
// mysqli_connect('domain', 'myuser', 'pasword', 'dbname', 3306);
if (!$link) {
    die('Could not connect');
}

echo 'Connected successfully';
exit;

Warning: mysqli_connect(): (HY000/2002): Connection refused

mujuonly
  • 11,370
  • 5
  • 45
  • 75

0 Answers0