PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused

The situation is this, I am trying to use a PHP connection to connect my MySQL Database which is on phpmyadmin. Nothing fancy about the connection just trying to see whether the connection is successful or not. I am using MAMP to host the database, the connection I am trying to use is this: