使用database队列驱动
php artisan queue:table
php artisan migrate
需要先设置数据库
vim .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_database
DB_USERNAME=root
DB_PASSWORD=mypassword
设置mysql使用的数据库,用户名,密码
执行migrate的时候报错
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes")mysql在5.7一下的话,对laravel的app\Providers\AppServiceProvider.php做以下++修改
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
++use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
++Schema::defaultStringLength(191);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
再次执行php artisan migrate
提示以下正常
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2019_05_06_100559_create_jobs_table
Migrated: 2019_05_06_100559_create_jobs_table
创建失败任务的表
php artisan queue:failed-table
php artisan migrate
以上几个表,并不是必要,看需求