Search code examples
laravelmigrate

Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes


[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


Solution

  • 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