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:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
//'charset' => 'utf8mb4',
//'collation' => 'utf8mb4_unicode_ci',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
And that is pretty much it.
You should be able to run a fresh migration without receiving the same error message.