1
votes

i have my app locally but i configured my .env and database.php in config\ to connect to a database hosted remotely in 000webhost but i get message whenever i perform php artisan migrate

SQLSTATE[HY000] [2002] Established connection failed because connected host has failed to respond.

or do i need to host my app online in order for it to work? Help.

1

1 Answers

1
votes

I suspect you're using 000webhost's free plan, which does not support remote MySQL connections. Their paid accounts do:

How can I connect to MySQL from my computer?

Remote MySQL connections are disabled for security and server performance reasons.

However remote MySQL connections will be enabled if you upgrade your account