Home > Software engineering >  Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key
Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key

Time:01-17

[enter image description here][1]After creating a new project, I migrate and it gives this error

This project is completely raw and no changes have been made enter image description here

After creating a new project, I migrate and it gives this error

This project is completely raw and no changes have been made

CodePudding user response:

Quick fix is your /app/Providers/AppServiceProvider.php must contain

use Illuminate\Support\Facades\Schema;
    
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }

If not work then try change database charset also

  • Related