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
If you are using Laravel Homestead, here is settings
(include Vagrant-Virtual Machine)
.bash-profile
alias vm="ssh vagrant@127.0.0.1 -p 2222"
database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'database' => env('DB_DATABASE', 'homestead'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', 'secret'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
Terminal
vm
vagrant@homestead:~/Code/projectFolder php artisan migrate:install
This happened to me because MySQL wasn't running. MySQL was failing to start because I had a missing /usr/local/etc/my.cnf.d/
directory.
This was being required by my /usr/local/etc/my.cnf
config file as a glob include (include /usr/local/etc/my.cnf.d/*.cnf
).
Running mkdir /usr/local/etc/my.cnf.d
, and then starting MySQL, fixed the issue.
In my case I had to remove the bootstrap/cache folder and try it again.
My cenario was after a server migration.
It worked after I change from DB_HOST=localhost
to DB_HOST=127.0.0.1
at .env file
I had this problems when I was running my application using docker containers.
The solution was put the name of the MySQL service container I was using in docker_compose.yml
on DB_HOST. In my case, it was db
:
DB_HOST=db
Hope it helps.
When using a VirtualMachine make sure you ssh into that machine and navigate to your App folder and call the php artisan migrate command from there.