mardi 27 février 2018

Issue connecting custom queue driver laravel 5.1 'No connector for [mysql]'

I have searched the query all over internet but till have not come up to the solution for this issue. No connector for [mysql]

I have 2 Mysql Connections mysql and mysql2. mysql is to store data and mysql2 to store QUEUE JOBS.

Here below is the .ENV file details.

 DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=laravel_5_1
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=mysql_queue

As you can see the about connection is DB_CONNECTION=mysql and my Queue driver QUEUE_DRIVER=mysql_queue

I have assigned and new queue driver named mysql_queue in queue.php

below is the queue.php code

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

'connections' => [
'mysql_queue' => [
            'connection' => 'mysql2',
            'driver' => 'mysql',
            'table' => 'jobs',
            'queue' => 'default',
            'expire' => 60,
        ],
]

'failed' => [
        'database' => env('DB_CONNECTION', 'mysql_queue'),
        'table' => 'failed_jobs',
    ],

As you can see the mysql_queue has 'connection' => 'mysql2', were i would like to store queued jobs. mysql2 is a new connection assiged in database.php below is the code.

'mysql2' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'database'  => env('DB_DATABASE', 'laravel_5_1_queue'),
        'username'  => env('DB_USERNAME', 'root'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
    ], 

Even after making these major changes as per laravel documentation i still get 'No connector for [mysql]' Error and unable to run QUEUED JOBS in background. kindly suggest me.

Thanks in Advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire