Search code examples
herokularavel-5

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


I am trying to run heroku run php artisan migrate and I get the error shown below. I have tried clearing config. I do not what the issue is.

What could be causing this, and how can I fix it?

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

Solution

  • So I had this same issue too. A couple of things might be wrong here. 1. Check all your parameters on your config setting on heroku to ensure they are correctenter image description here. You can connect to your db using sequel Pro to check that all your config variables are correct. In my case, I used Mysql so I had to use an add-on on heroku (cleardb)

    1. Ensure that your .env file is not removed from your .gitignore. Which means .env is not supposed to be part of the commit. If your .env file is found in the repo too, there will be clash of which environment variables to use.