[PDOException] SQLSTATE [42000]:
Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
out of the box method: app / Providers / AppServiceProvider.php
public function boot() { // } [PDOException] SQLSTATE [42000]:
Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
out of the box method: app / Providers / AppServiceProvider.php
public function boot() { // } SOLVED: Add to boot () method in:
app/Providers/AppServiceProvider.php public function boot() { Schema::defaultStringLength(191); } And also do not forget to import the database:
use Illuminate\Support\Facades\Schema; This error appears on MySQL 5.6 versions. Another solution may be to change the encoding in database.php
'charset' => env('DB_CHARSET', 'utf8'), 'collation' => env('DB_COLLATION', 'utf8_general_ci'), Source: https://ru.stackoverflow.com/questions/897878/
All Articles