When encountering the error "Specified key was too long" during migrations with Laravel, particularly while executing the "make:auth" command, it's indicative of a key length issue.
According to Laravel documentation, a straightforward fix is to modify your /app/Providers/AppServiceProvider.php file:
use Illuminate\Support\Facades\Schema; /** * Bootstrap any application services. * * @return void */ public function boot() { Schema::defaultStringLength(191); }
Alternatively, the "innodb_large_prefix" option can be enabled in your database. Refer to your database's documentation for detailed instructions on how to activate this option.
The above is the detailed content of How to Resolve the 'Specified Key Was Too Long' Error in Laravel Migrations?. For more information, please follow other related articles on the PHP Chinese website!