Member-only story
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
Hi friends, in this tutorial, you will learn how to resolve SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table users
add unique users_email_unique
(email
)). This error occurs when we run the database migrations in any of the Laravel projects with the help of the artisan command php artisan make: migrate as shown below.
In the above image, you have noticed that the error occurs after running the migration artisan command. But don’t worry, if you are wondering to fix this then you have come to the right place. This particular error is shown at the time of migrating tables that are defined under your Laravel project/database/migrations.
These kinds of errors often occur due to the structure declaration in the MySQL databases such as index column size too large and row size too large etc. You can fix these errors in phpmyadmin of your local server like the Wamp server or xampp server etc.
Also read, How to fix phpmyadmin #1709 — index column size too large