Laravel Mysql Connection error

I am using the free hosting version of 000webhost to host a laravel project. I was able to configure the public files and the home page can be loaded.
However, I can’t connect to the mysql databases from my laravel files.
Everytime when I try to connect to the database or send a query the server responded that It is an access violation. I have already rechecked my database confidentials for many times. And I have also hosted other laravel projects on 000webhost. I spent around 6 hours trying to get around this specific error by looking at the database connections, changing them and resetting my website.
I want to know if this is an error from the hosting services or the connections methods were changed to something else other than when I last used 000webhost, which is 1 months ago.

Laravel isn’t fully supported on free plan if you have a search around the forums putenv is disabled etc which Laravel requires to run correctly.

Try this video:

Or use alternative free hosting or upgrade to avoid issues.