I was trying do download an existing project into my local environment today, and after performing the composer installation and to set up the database parameters on the proper config file, I ran the migration process and I received the following error message within the console:

SQLSTATE[HY000]: General error: 1709 Index column size too large. The maximum column size is 767 bytes….

VARCHAR(255) column can take up to 765 (255*3) bytes using utf8 and 1020 (255*4) bytes using utf8mb4. This is because in MySQL utf8 takes up to 3 bytes and utf8mb4 up to 4 bytes (the real UTF8). Thus creating a VARCHAR(255) (unique) index with utf8mb4 will fail.

A quick fix will be to open your database.php file and modify the charset and collation to UTF8 like this:

And that is pretty much it.

You should be able to run a fresh migration without receiving the same error message.

Leave a comment