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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With