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

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Fri May 18, 2018 2:14 am

Fri May 18, 2018 2:27 am


I'm new in this creating websites thing. I'm looking for some help with Connection failed: SQLSTATE[HY000] [2002] Connection refused. I've spent around 5 hours by trying to find out what is the problem. I'm trying to make a website to connect to my computers MySQL database. I've tried so many things but nothing works... I've tested everything on wamp and everything works flawlessly but as soon as I've uploaded to host seems to be like nothing works.
I've used this code to connect it but it keeps giving me Connection failed: SQLSTATE[HY000] [2002] Connection refused(I've changed IP and password because I've taken all protection of my pc just to get this running but I will be bashing my head into a wall soon...

$connect = 'mysql:host=88.888.888.88;dbname=yeet';

try {
$db = new PDO($connect,'root','password');
} catch (PDOException $e) {
echo $e->getMessage();

I know that I can connect to MySQL with my phone so it has to be accessible to everybody and it works when I use wamp as my IP and connection are all on IP but it doesn't work as I upload :(
If anyway can help me out please help me!
As well I'm using windows 10 and MySQL 5.5

Thank you

Post Reply