close

[Solved] “No such file or directory” or “No such host is known” when running migrations

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error “No such file or directory” or “No such host is known” when running migrations in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How “No such file or directory” or “No such host is known” when running migrations Error Occurs?

Today I get the following error “No such file or directory” or “No such host is known” when running migrations in php.

How To Solve “No such file or directory” or “No such host is known” when running migrations Error ?

  1. How To Solve “No such file or directory” or “No such host is known” when running migrations Error ?

    To Solve “No such file or directory” or “No such host is known” when running migrations Error If you are using localhost as your DATABASE_HOST in the .env file, change it to 127.0.0.1, then run php artisan config:clear and now try php artisan migrate:install again.

  2. “No such file or directory” or “No such host is known” when running migrations

    To Solve “No such file or directory” or “No such host is known” when running migrations Error If you are using localhost as your DATABASE_HOST in the .env file, change it to 127.0.0.1, then run php artisan config:clear and now try php artisan migrate:install again.

Solution 1

If you are using localhost as your DATABASE_HOST in the .env file, change it to 127.0.0.1, then run php artisan config:clear and now try php artisan migrate:install again.

Solution 2

If you are using MAMP Pro (not always necessary for the free version of MAMP) then the best thing to do is add this to your .env file:

DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock

This assumes your MAMP installation is at /Applications/MAMP of course (the default).

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment