Unable to connect to MySQL through PHP script when using mysqli or PDO BUT mysql works
问题 I am facing a weird situation. When I am trying to connect to MySql database using a "mysql" connection, it works. mysql connection string -> mysql_connect($HOST, $USER, $PASSWORD, $DB); But the connection fails immediately fails when I use either "mysqli" or "PDO" mysqli connection string -> mysqli_connect($HOST, $USER, $PASSWORD, $DB); PDO Connection string -> new PDO("mysql:host=$HOST;dbname=$DB", $USER, $PASSWORD); The specific error that it throws is, SQLSTATE[HY000] [2003] Can't connect