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 :: laravel decrement 
Php :: wordpress single post get category name 
Php :: php check if folder empty 
Php :: php function to convert string to camelcase 
Php :: Get color code from string 
Php :: How to add new column in table laravel 
Php :: counting time execution duration in time laravel 
Php :: push element at tart of arrray php 
Php :: how to check exist in array in rule validation laravel 
Php :: php get all saturdays in a month 
Php :: How to get only year, month and day from timestamp in Laravel 
Php :: laravel include files 
Php :: relative path php 
Php :: if value conatins in word check in php 
Php :: php curl pass user:password 
Php :: downgrade php version vagrant 
Php :: php string replace regex 
Php :: remove .php from url 
Php :: php header location not working 
Php :: laravel required only one of multiple fields not both 
Php :: rename migration in laravel 
Php :: php multi type parameter union types 
Php :: php base64img to file 
Php :: laravel serve in another port 
Php :: require all files in directory php 
Php :: num_rows in php 
Php :: Session store not set on request. 
Php :: laravel drop column 
Php :: laravel make directory 
Php :: php artisan vendor:publish 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =