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.
Add mysql.sock path in database.php file like below example
Eample
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!
Mamp user enable option Allow network access to MYSQL
I had problems accessing my drupal website and I had a problem exactly like that I fixed it within less than 2 hours. Try on your command line and restart your mysql server or service. Type this when logged in as root or super user, - service mysqld restart
It should work. If it doesn't restart your local webserver, - service httpd restart
That should be enough. Hope it works for other environments too. Cheers.
In my case, I was running php artisan migrate on my mac terminal, when I needed to ssh into vagrant and run it from there. Hope that helps someone the headache.
Check your port carefully . In my case it was 8889 and i am using 8888. change "DB_HOST" from "localhost" to "127.0.0.1" and vice versa