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.