laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length

Posted php+go 刘杰

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length相关的知识,希望对你有一定的参考价值。

在按照文档执行php artisan migrate时报错。

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))

  解决方法

namespace AppProviders;

use IlluminateSupportServiceProvider;
use IlluminateSupportFacadesSchema;

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

  

以上是关于laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length的主要内容,如果未能解决你的问题,请参考以下文章

Laravel 5 migrate时报错: Specified key was too long error

Laravel 5.4 migrate时报错: Specified key was too long error

Laravel 5.4 migrate报错:Syntax error or access violation: 1071 Specified key was too long; max key len

Lavarel 执行:php artisan migrate时报错

vs2013, EF6.0.0.0 使用Migrations来更新数据库时报错

webpack打包时报错:Support for the experimental syntax 'classProperties' isn't currently enabl