I believe that I've successfully deployed my (very basic) site to fortrabbit, but as soon as I connect to SSH to run some commands (such as php artisan migrate
or php artisan db:seed
) I get an error message:
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
At some point the migration must have worked, because my tables are there - but this doesn't explain why it isn't working for me now.
The answer from @stuyam solved the "No such file or directory" issue for me
But then I had a "Connection refused" error. If anyone had the same issue, my solution for this was to update the app/config/local/database.php file so the port is 8889:
Attempt to connect to localhost:
Attempt to connect to 127.0.0.1:
OK, just comment / remove the following setting from my.cnf (on OS X 10.5:
/opt/local/etc/mysqlxx/my.cnf
) to obtain:Of course, stop and start MySQL Server.
I ran into this problem when running PHPUnit in Elixir/Gulp, and Homestead as my Vagrant enviroment.
In my case I edited the .env file from
DB_HOST=localhost
toDB_HOST=192.168.10.10
where192.168.10.10
is the IP of my Vagrant/Homestead host.It worked after I change from
DB_HOST=localhost
toDB_HOST=127.0.0.1
at .env fileBuilding on the answer from @dcarrith ...
Instead of editing the config files, I created an alias in the location that PHP is looking that connects to the real mysql.sock. (source)
Just run these two commands (no restart needed):
I'm running on MAMP Pro and had this similar problem when trying to migrate (create db tables). Tried a few of these mentioned suggestions as well but didn't do it for me.
So, simply (after an hour googling), I added two things to the /config/database.php.
Works fine now!