Migration Error on Laravel 5.7

Posted 4 months ago by PatrickL

I am getting this wierd error when I try to run my migrations on localnost. First, here is my env file (the connections part at least).

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cgn
DB_USERNAME=root
DB_PASSWORD=root

My credentials look right on my sql database. However, when I run migrate, I get the following error:

Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = cgn and table_name = migrations)

I change the DB_HOST property to "localhost". But, now I get this error.

  Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = cgn and table_name = migrations)

I tried testing the migration on a blank Laravel project (as in I made no changes after creating it). I am getting the same errors. I am on Mac BTW, running MAMP.

Any suggestions what's going on?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.