Issue
Migration error on Laravel 5.4 with php artisan make:auth
[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter tabl e
usersadd uniqueusers_email_unique([PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
Solution
According to the official Laravel 7.x documentation, you can solve this quite easily.
Update your /app/Providers/AppServiceProvider.php to contain:
use Illuminate\Support\Facades\Schema;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
Alternatively, you may enable the
innodb_large_prefixoption for your database. Refer to your database's documentation for instructions on how to properly enable this option.
Answered By - abSiddique Answer Checked By - Marie Seifert (sql.easybugfix Admin)
Post a Comment
Post a Comment