Laravel – Migration : Syntax error 1071 specified key was too long

The first try Laravel to migrate then i got error Syntax error or access violation : 1071 Specified key was too long. Thought Mysql have some error or Laravel version (5.6) not compatible with current Mysql, so i try to rollback Laravel version to 5.4 and still got that error when migrate. So bellow is the solution to fix migrate error :

- Open file database.php located in config folder
- Edit 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci' and change to 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci'

I think it should work after the changes is made.

Leave a Reply

Your email address will not be published. Required fields are marked *