laravel报错1071 Specified key was too long; max key length is 1000 bytes

2022-09-11 12:36:59 浏览数 (1)

执行php artisan migrate报错laravel报错1071 Specified key was too long; max key length is 1000 bytes

Laravel 5.4以后默认使用utf8mb4字符编码,而不是之前的utf8编码。因此运行php artisan migrate 会出现了上面的错误。 修改AppProvidersAppServiceProvider.php文件

代码语言:javascript复制
 /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }

0 人点赞