Faith
Faith

Reputation: 35

fortrabbit new apps and laravel artisan

I just started a new L5.1 app wit fortrabbit new app features,but I couldn't find the way how can use artisan commands, in old apps I used ssh,but now it is not accesible. I need "php artisan migrate" and "php artisan db:seed " commands,how can I do without ssh access?

Upvotes: 1

Views: 384

Answers (1)

ukautz
ukautz

Reputation: 2213

Add a new database configuration to config/database.php:

// ..
'connections' => [
    // ..
    'mysql-tunnel' => [
        'driver'    => 'mysql',
        'host'      => '127.0.0.1',
        'port'      => '13306',
        'database'  => 'my-app',
        'username'  => 'my-app',
        // don't save the password with your code
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
    ],
],

Then setup a tunnel:

$ ssh -N -L 13306:my-app.mysql.eu2.frbit.com:3306 [email protected]

Now you can run locally (in another terminal window):

$ DB_PASSWORD="your-password" php artisan migrate --database=mysql-tunnel
$ DB_PASSWORD="your-password" php artisan db:seed --database=mysql-tunnel

Upvotes: 1

Related Questions