1

The following: Is the error I would receive (Mind you if it's not the users table, it's the failed_jobs or reset_password table. The majority of the issues comes from the laravel auto-generated tables. And yes I did try PHP artisan migrate: reset, drop the tables from the localhost, I've even dropped the database itself)

Migrating: 2014_10_12_100000_create_password_resets_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 `password_resets` add index `password_resets_email_index`(`email`))

  at C:\xampp\htdocs\project1\project\seed\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|         }
    675| 

  1   C:\xampp\htdocs\project1\project\seed\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464
      PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes")

  2   C:\xampp\htdocs\project1\project\seed\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464
      PDOStatement::execute()

And this is what the database/migration/create_reset_password_table looks like so far.

class CreatePasswordResetsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('password_resets', function (Blueprint $table) {
            $table->string('email')->index();
            $table->string('token');
            $table->timestamp('created_at')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('password_resets');
    }
}

Thank you in advance for all the help! :)

Gambit
  • 13
  • 4

1 Answers1

0

Laravel default collation type has changed to utf8mb4.

In your

AppServiceProvider.php

boot method the following line

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}
FULL STACK DEV
  • 15,207
  • 5
  • 46
  • 66