With the new version of Laravel if you try to migrate your table into the database with php artisan migrate command. You might receive this Exception "Syntex error or access violation : 1071 Specified key was too long; max key length is 767 bytes"

 

 

Laravel 5.5 made a change to the default database character set that now supports storing emojis, and it’s now utf8mb4.  This only affects new applications and as long as you are running MySQL v5.7.7 and higher you do not need to do anything.

For those running MariaDB or older versions of MySQL to get rid of this error you need to do the following

Open your AppServiceProvider.php located under App > Providers and modify the boot() method

   
    use Illuminate\Support\Facades\Schema;

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

migrate command should work fine after this !

Comments