美文网首页
Laravel 5.4 failing on php artis

Laravel 5.4 failing on php artis

作者: 天黑北风吹 | 来源:发表于2017-02-06 14:44 被阅读43次

    1.执行

    $ php artisan migrate
    

    报错:

    [Illuminate\Database\QueryException]                                            
      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`))                                                         
                                                                                
      [PDOException]                                                                  
      SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too   
      long; max key length is 767 bytes     
    

    2.解决:
    修改app\Providers\AppServiceProvider.php

    use Illuminate\Support\Facades\Schema;
    
    function boot()
    {
        Schema::defaultStringLength(191);
    }
    

    相关文章

      网友评论

          本文标题:Laravel 5.4 failing on php artis

          本文链接:https://www.haomeiwen.com/subject/paxuittx.html