Migration table created successfully.

Migrating: 2000000_create_users_table

   Illuminate\Database\QueryException

  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`))

  at ...\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671

    667|         // If an exception occurs when attempting to run a query, we'll format the error

    668|         // message to include the bindings with SQL, which will make this exception a

    669|         // lot more helpful to the developer instead of just the database's errors.

    670|         catch (Exception $e) {

  > 671|             throw new QueryException(

    672|                 $query, $this->prepareBindings($bindings), $e

    673|             );

    674|         }


Solution:

Go to - app\Providers\AppServiceProvider.php

change it-

use Illuminate\Support\Facades\Schema;


public function boot()

{

    Schema::defaultStringLength(191);

}


Post a Comment

Previous Post Next Post