I have an existing laravel application that technically works fine (local computer). I connect to the DB, do many things with it and everything is fine.
I added a migration and when trying to migrate it, I get the following error:
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = dbname and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
+36 vendor frames
37 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
- Laravel version: 7.30.6
- PHP version 7.4.21
- Using MAMP on a Mac if it makes a difference.
my .env
:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME=root
DB_PASSWORD=root
For some reason, I tried changing the DB_HOST
to "127.0.0.1"
and it would not work.
I tried many things, but nothing works:
- Cache clearing
- Config caching and clearing
- Composer update
- Composer install
- Composer dump-autoload
Nothing seems to be working.
Though it makes no sense because everything else is working perfectly, and the migration seems to not be able to connect to the DB. (I checked and there indeed is a migrations table)
Any tips would be much appreciated here.
Thank you