aimeos / aimeos-laravel

Laravel ecommerce package for ultra fast online shops, scalable marketplaces, complex B2B applications and #gigacommerce
https://aimeos.org/Laravel
MIT License
7.34k stars 1.05k forks source link

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

Closed aescasio closed 7 years ago

aescasio commented 7 years ago

Hi,

Got MySQL error "1071 Specified key was too long; max key length is 1000 bytes" when I execute the "php artisan aimeos:setup".

I followed the installation steps found: https://github.com/aimeos/aimeos-laravel

Exact error:

[Aimeos\MW\DB\Exception] Executing statement "CREATE INDEX users_status_address1_address2_index ON users (status, address1, address2)" failed: An exception occur red while executing 'CREATE INDEX users_status_address1_address2_index ON users (status, address1, address2)': SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

Vesions I used: MySQL v.5.7.14 Laravel 5.3.30

Inside composer.json


    "require": {
        "php": ">=5.6.4",
        "doctrine/dbal": "~2.3",
        "infyomlabs/adminlte-templates": "5.3.x-dev",
        "infyomlabs/laravel-generator": "5.3.x-dev",
        "laravel/framework": "5.3.*",
        "laravelcollective/html": "^5.3.0",
        "santigarcor/laratrust": "3.2.*",
        "aimeos/aimeos-laravel": "~2016.10"
    },

    "scripts": { 
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize",
            "php artisan vendor:publish --tag=public --force",
            "php artisan vendor:publish",
            "php artisan migrate"
        ]
    },

I also tried changing the engine from "null" to "InnoDB ROW_FORMAT=DYNAMIC"

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', /* null */
    ],

My.ini: sort_buffer_size = 2M

aescasio commented 7 years ago

Sorry, I got it now: Just want to share in such cases that happens to you.

I install Laravel and migrate the table with engine => null by default before the installation of Aimeos.

To solve the problem I just alter my users table to ENGINE=INNODB.

Sorry to bother anyone reading this.