Resolve error Connection failed: SQLSTATE[HY000] [2002] Permission denied

Home > Search
  by

This error appears when attempting to make a connection to MySQL or MariaDB using PHP. Following are a list of things to check when this error appears.

  1. Ensure you are port forwarding on ports 80 and 443 in your router
  2. In your PHP connection string, try to connect using the IP address of the LAMP server. If the connection is successful when using the IP address but fails when using the domain name, this suggests there is no entry in the /etc/hosts file on the LAMP server mapping the domain name to the IP address. Map the IP address to the domain name in the /etc/hosts file on the LAMP server.
  3. Make sure you can ping example.com


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments