使用AWS建立mysqli连接

I am trying to establish a connection using mysqli as to connect with the database. Using the same credentials (host, username, and password), I have been able to successfully login in mysql workbench so I know the credentials are correct. However, I constantly receive the following error:

Failed to connect to MySQL:No such file or directory.

<?php
$con = mysqli_connect("...west-2.rds.amazonaws.com","usernameshown in aws rds","password","database name");

if (mysqli_connect_errno())
{
    echo "Failed to connect to MySQL:" . mysqli_connect_error();
}

?>