teguh_rijanandi's avatar

How Fix This Error??

production.ERROR: SQLSTATE[HY000] [2002] No such file or directory {"exception":"[object] (PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /storage/ssd2/855/6246855/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:67)

My projects are hosted in 000webhost

0 likes
4 replies
jlrdw's avatar

Are you able to connect using phpmyadmin. Are you sure DB_HOST is correct.

teguh_rijanandi's avatar

This My project connections (in .env)

DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=id6246855_oss DB_USERNAME=id6246855_teguh DB_PASSWORD=********* (Sensored)

jlrdw's avatar

DB_HOST=localhost is correct for development, but I don't think it's correct for your hosting server.

Double check with 000webhost what it should be. You could be right, but I don't use them.

Also try the correct ip number instead of localhost

But on 000webhost can you access the data and run queries in phpmyadmin?

If so, probably a problem in your laravel settings. If not, then a problem in your setup on 000webhost.

teguh_rijanandi's avatar

I also use CRUD (Create Read Update Delete) outside the env file connection. CRUD is successful and runs normally. And the connections same as in env

Please or to participate in this conversation.