bestmomo / laravel5-5-example

Laravel 5.5 example for tutorial
217 stars 121 forks source link

Sql Error #18

Open farmaworld opened 6 years ago

farmaworld commented 6 years ago

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 password_resets add inde
x password_resets_email_index(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

bestmomo commented 6 years ago

Check your MySQL version, look at that.

jkoech commented 6 years ago

Edit AppServiceProvider.php and add Schema::defaultStringLength(191); to the boot method as below:

public function boot()
{
    Schema::defaultStringLength(191);
}
sims34 commented 5 years ago

PHP : 7.2 LARAVEL : 5.7

An other solution In the folder config/database.php into mysql

 'charset' => 'utf8mb4',
 'collation' => 'utf8mb4_unicode_ci',

remove mb4 for get this :

'charset' => 'utf8',
  'collation' => 'utf8_unicode_ci',

Delete all tables into your mysql interface (such as phpMyAdmin) for get no conflict. And run php artisan migrate --seed again It's work for me. Good Luck