首页 > 数据库技术 > 详细

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

时间:2020-01-12 10:12:42      阅读:72      评论:0      收藏:0      [点我收藏+]

在按照文档执行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 App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;

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 is 767 bytes

原文:https://www.cnblogs.com/liujie-php/p/12181958.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!