Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ardakocaktr opened this issue Aug 29, 2017 · 8 comments
Open

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

ardakocaktr opened this issue Aug 29, 2017 · 8 comments

Comments

@ardakocaktr
Copy link

ardakocaktr commented Aug 29, 2017

I got this error

mysql version : MariaDB 10.2.8
php version : 7.0.22

and Tried this code in AppServiceProvider . still didnt work :
Schema::defaultStringLength(191);

@lildigiman
Copy link

I am getting this error as well when trying to migrate the tracker DB:

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table tracker_agents add unique tracker_agents_name_unique(name)) (SQL: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table tracker_agents add unique tracker_agents_name_unique(name)))

@antonioribeiro
Copy link
Owner

We have some new migrations in place to help fixing this error, did you try them?

@oppenheimer
Copy link

I found the same issue but it was not fixed with the "Schema::defaultStringLength(191);" added to the AppServiceProvider.php.
I changed the DB storage from MyISAM to InnoDB and it worked.

@devWaleed
Copy link

I faced this issue as well. The best solution to solve this (imo) is to use InnoDB engine for tracker tables. By default all tables will use MyISAM.

        'tracker' => [
            'strict' => false, 
            'engine' => 'InnoDB', // this bit
        ]

@i-emek
Copy link

i-emek commented Feb 18, 2019

I've got the same error, tryr the solution of devWaleed.

@alshoja
Copy link

alshoja commented Jul 23, 2019

Getting the same issue on the shared server, can I get a fix on this?

Traces
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table tracker_languagesadd uniquetracker_languages_preference_language_range_unique(preference, language-range)) (SQL: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table tracker_languagesadd uniquetracker_languages_preference_language_range_unique(preference, language-range)))

@alshoja
Copy link

alshoja commented Jul 23, 2019

I got the Error fixed by changing the tracker database

 'strict' => true,          
 'engine' => 'InnoDB',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants