serverfireteam / panel

An easily configurable admin panel for Laravel applications.
MIT License
427 stars 144 forks source link

Error 1071: Specified key was too long; max key length is 1000 bytes #400

Open GameO7er opened 5 years ago

GameO7er commented 5 years ago

After running php artisan panel:install it gives me :

Migrating: 2014_11_16_205658_create_admins_table
Migrated:  2014_11_16_205658_create_admins_table (0.18 seconds)
Migrating: 2014_12_02_152920_create_password_reminders_table

   Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `password_reminders` add
 index `password_reminders_email_index`(`email`))

and here is Exception trace:


  1   PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")
      C:\wamp\www\Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  2   PDOStatement::execute()
      C:\wamp\www\Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  Please use the argument -v to see more details.

admins , migrations , password_reminders have been created successfully with 1 row except password_reminders which have no rows.

GameO7er commented 5 years ago

If anybody facing same problem, Please follow the below steps to fix the issue:

  1. Update the "config/database.php" for 'mysql'

'engine' => null,

to

'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',

= -= - = - = - = - = - =

  1. Update the app/Providers/AppServiceProvider.php with
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        // Specified key was too long error, Laravel News post:
        Schema::defaultStringLength(191);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

= -= - = - = - = - = - =

  1. Execute Command:
php artisan cache:clear
php artisan config:clear
php artisan panel:install

Now, everything should works! :)