Laravel 5 How to configure the Queue database driver to connect to a non-default database?

You can use the 'connection' parameter in queue.php to set the correct database connection ( from the ones you've defined in database.php ).

'database' => [
    'connection' => 'mysql2',
    'driver' => 'database',
    'table' => 'jobs',
    'queue' => 'default',
    'expire' => 60,
], 

I was looking for the same thing and found it in the source code.

NOTE: This will not only read the jobs from this connection ( when running the queue ), but also write them to this connection ( when dispatching a new Job ) .


The best answer here did not work for me, not to say it isn't the best answer for a different issue than mine. My issue was that Laravel did not cache my config settings.

After going into file \config\queue.php and changing the default driver...

'default' => env('QUEUE_DRIVER', 'database'),

The queue was still running on the sync driver.

I then checked the file...

    \bootstrap\cache\config.php

Around line 30 I saw this...

 'queue' => 
array (
'default' => 'sync', 

...but to connect to the database, it should be...

 'queue' => 
array (
'default' => 'database',

This resolved the issue...

php artisan config:cache

Running the config:cache commmand rewrites the config.php file to the current driver settings.