Syntax error or access violation: 1071 Specified key was too long

When running database migration in a new larvel project, i get following error

[email protected]:~/www/proxy (master)$ php artisan migrate

In Connection.php line 664:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

In Connection.php line 458:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

[email protected]:~/www/proxy (master)$

This is due to recent change in Lavral, that changed default charset to utf8mb4.

To fix this error, open file

Find

Add below

Find

Replace with