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

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

boby@hon-pc-01:~/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

boby@hon-pc-01:~/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

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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