简体   繁体   中英

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?

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 tunnel@tunnel.eu2.frbit.com

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM