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

laravel 执行 php artisan migrate 安装数据库报

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

数据库不支持长字节 需要在 AppServiceaProvider.php文件里面添加状态码191 具体代码如下

use Illuminate\Support\Facades\Schema;  // 必须的
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //  数据库不是 mysqli的 需要写个码
        Schema::defaultStringLength(191); // 191
    }

猜你喜欢

转载自blog.csdn.net/genziisme/article/details/80576579