Posts

Showing posts from March, 2024

Laravel 10 - Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `users` add unique `users_email_unique`(`email`))

 I got the following error when executing the migration command for the first time.  PS C:\wamp64\www\example-app> php artisan migrate    INFO  Running migrations.   2014_10_12_000000_create_ users_table .............................. .............................. ......... 39ms FAIL    Illuminate\Database\ QueryException   SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `users` add unique `users_email_unique`(`email`))   at vendor\laravel\framework\src\ Illuminate\Database\ Connection.php:829     825▕                     $this->getName(), $query, $this->prepareBindings($ bindings), $e     826▕                 );     827▕             }     828▕   ➜ 829▕             throw new QueryException(     830▕                 $this->getName(), $query, $this->prepareBindings($ bindings), $e     831▕             );     832▕         }     833▕     }   1   vendor\laravel\framework\src