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

SQLSTATE[42000]: Syntax error or access violation: 1071 #25

Open
glupeksha opened this issue Mar 23, 2020 · 1 comment
Open

SQLSTATE[42000]: Syntax error or access violation: 1071 #25

glupeksha opened this issue Mar 23, 2020 · 1 comment
Labels

Comments

@glupeksha
Copy link

glupeksha commented Mar 23, 2020

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table world_cities add index uniq_city(country_id, division_id, name))

This error occurred when php artisan world:init command is executed

@yehanny
Copy link

yehanny commented May 4, 2020

Hi @upeksha1996 you can try this solution it worked for me:

Option 1: Add the following to your my.ini Config file, I did it on XAMPP Control Panel > Config > my.ini and look for the InnoDB options and place this code below, restart MySQL and Apache and it should work.

innodb-file-format=barracuda
innodb-file-per-table=ON
innodb-large-prefix=ON
innodb_default_row_format = 'DYNAMIC'

Option 2

Also you can try to update your app/Providers/AppServiceProvider.php

use Illuminate\Support\Facades\Schema; // Import Schema where defaultStringLength method is defined

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

@khsing khsing added the wontfix label Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants