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!


1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I do have the same problem when using valet in Mac can u please help me on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.