php artisan migrate:错误

时间:2018-01-29 11:27:57

标签: php laravel

$ php artisan migrate
Migration table created successfully.
In Connection.php line 647:
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`))
In Connection.php line 449:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

问题是什么?:|

1 个答案:

答案 0 :(得分:1)

将此添加到AppServiceProvider.php

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}