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.

Edit:

To:

I did it with Laravel 9.x

Related Answers

Laravel- How to filter if date-time field with AM or PM date format?

Laravel query filter if date-time field with AM or PM date format. I will show between query on “open_at” and “close_at” field by using mysql STR_TO_DATE method.

Date Time field with AM or PM query:

Related Answers

Laravel- How to check user login password hash?

Laravel Hash façade provides secure Bcrypt hashing for storing user passwords. This will return true or false based on user given the password if matches or not.

Laravel Password Hash:

Related Answers

Laravel- How to send email from any controller?

I show an sample below, how to send email from Laravel any controller, for details (class, template and send example) please click on How to send email? here.

Create email class with build method on App => Mail directory.

Use email class on your controller or helper where from you want to send email.

Email send example:

Related Answers

Laravel – Join Query with Multiple conditions

In this article I will show you how to add multiple condition in the join query of Laravel Query Builder by using “on” method.

Related Answers