Search
 
SCRIPT & CODE EXAMPLE
 

PHP

1071 Specified key was too long; max key length is 1000 bytes

// /app/Providers/AppserviceProvider.php

use IlluminateSupportFacadesSchema;

public function boot()
{
	Schema::defaultStringLength(191);
}
Comment

specified key was too long max key length is 767 bytes

# AppServiceProvider.php

use IlluminateSupportFacadesSchema;

public function boot()
{
    Schema::defaultStringLength(191);
}
Comment

Specified key was too long; max key length is 1000 bytes

In appProvidersAppServiceProvider.php File

// Add 
use IlluminateSupportFacadesSchema;

public function boot() {
	// Add In boot function 	
	Schema::defaultStringLength(191);
}
Comment

violation: 1071 Specified key was too long; max key length is 1000 bytes

Inside config/database.php, replace this line for mysql

Copy Code
'engine' => null',
with

Copy Code
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
Instead of setting a limit on your string lenght.
Comment

Specified key was too long; max key length is 767 bytes

I had this error and I changed my tables column length smaller for the indexed foreign key columns so I changed it like this:

VARCHAR(1024)
To:

VARCHAR(512)
And run the query again.
Comment

PREVIOUS NEXT
Code Example
Php :: CLI to create a new laravel project 
Php :: php routing htaccess 
Php :: serve php file 
Php :: laravel htaccess tested 
Php :: wordpress print all categories 
Php :: laravel debugbar 
Php :: view a pdf file in the browser using the php header function 
Php :: php make query string from array 
Php :: php artisan db:seed Call to undefined method AppModelsProduct::factory() 
Php :: get term thumbnail 
Php :: laravel blade uppercase 
Php :: date casting from datetime to d-m-Y laravel 
Php :: Syntax error or access violation: 1071 La clé est trop longue. Longueur maximale: 1000 
Php :: wordpress get post id 
Php :: php dom add class to element 
Php :: php cut off first x characters 
Php :: check image is available on server php 
Php :: how to check if a string contains a substring in php 
Php :: laravel make trait command 
Php :: npm watch laravel 
Php :: count object php 
Php :: seed one table laravel 
Php :: string to uppercase laravel 
Php :: base64 decode in php 
Php :: get database name laravel 
Php :: php convert words with spaces to camelcase 
Php :: wordpress PHPMailer config 
Php :: remove all html codes using php 
Php :: wordpress post date 
Php :: php server name 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =