laravel php artisan migrate Error (timeout)
Asked Answered
A

1

6

I am using Laravel 5.6

when I use the command 'php artisan migrate' I get this error (after a minute) :

"Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] Operation timed out (SQL: select * from information_schema.tables where table_schema = MYDATABASE and table_name = migrations)"

I have set up the correct database configuration in .env and config/database.php

I checked that my db connection works : if(DB::connection()->getDatabaseName()) { echo "Yes! successfully connected to the DB: " . DB::connection()->getDatabaseName(); }

And it works.

if i run the query directly in mysql, it will not work because of the lack of quotes. if instead I run this in mysql it will work:

select * from information_schema.tables where table_schema = 'MYDATABASE' and table_name = 'migrations'

the issue in php artisan seem to be : "Operation timed out" (not the usual "File not found" when i tried to look for an answer here.

How to solve the php artisan migrate issue ??? thank you!


Artema answered 24/2, 2018 at 23:55 Comment(0)
D
1

I had this same problem and it turned out my host was incorrect.

In my .env file I set DB_HOST to the correct value and it all worked like a charm.

Drucie answered 13/3, 2018 at 15:13 Comment(1)
I do have the same problem when using valet in Mac can u please help me on this.Moscow

© 2022 - 2024 — McMap. All rights reserved.