Php工匠迁移失败了Laravel

erc*_*cvs 5 php laravel

我有以下错误.有人理解为什么?

php工匠迁移

 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`))
Run Code Online (Sandbox Code Playgroud)

create_users_table.php

Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name',255);
    $table->string('email',255)->unique();
    $table->string('password',255);
    $table->rememberToken();
    $table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)

Leo*_*ent 5

您要做的就是编辑App\Providers\AppServiceProvider文件中的 AppServiceProvider.php 并在 boot 方法中设置默认字符串长度:

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}
Run Code Online (Sandbox Code Playgroud)

然后手动删除数据库composer dump-autoload然后php artisan migrate