0

I'm using the following to connect to MySQL

<?php
    $con = mysqli_connect('127.0.0.1', 'root', 'root', 'chat');

    if(mysqli_connect_errno($con)) {
        echo mysqli_connect_error($con);
        die;
    }
?>

But, I'm given the following error

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

I've never run into this error before and I have no idea what it means. I'm able to connect my DB via PHPMyAdmin and an SQL desktop client.

idmean
  • 14,540
  • 9
  • 54
  • 83
Lance
  • 4,736
  • 16
  • 53
  • 90

0 Answers0