laravel-admin安装的时候运行php artisan admin:install命令报错SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1。。。处理方法

时间:2020-08-18 13:14:43   收藏:0   阅读:75

错误如下所示:

技术图片

 

 

 首先删除已经创建的两张表,然后在app\Providers\AppServiceProvider.php文件中boot方法中增加默认值,别忘记引入

Schema类
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema; //add fixed sql

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191); //add fixed sql
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
之后运行
php artisan admin:install 命令
安装成功
成功如图所示
技术图片

 

 

 
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!