Laravel migration syntax error access violation 1071 specified key was too long

Laravel migration syntax error, SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `personal_access_tokens` add index `personal_access_tokens_tokenable_type_tokenable_id_index`(`tokenable_type`, `tokenable_id`))

What worked for me was editing the config/database.php file in config directory.



I did it with Laravel 9.x

Related Answers