[GH-ISSUE #552] Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes #393

Closed
opened 2026-02-26 02:33:04 +03:00 by kerem · 8 comments
Owner

Originally created by @cllorca on GitHub (Mar 7, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/552

I couldn't find this issue in the troubleshooting section of the documentation, nor could I find it here in the git issue tracker. I followed the steps for installation according to installation guide: https://koel.phanan.net/docs/#/?id=installation

composer.phar executed fine. Then I added my db credentials to .env. Finally when I ran php artisan koel:init' I got the following error which halts the installation as the database seeding fails:

php artisan koel:init
Attempting to install or upgrade Koel.
Remember, you can always install/upgrade manually following the guide here:
📙 https://koel.phanan.net/docs

App key exists -- skipping
JWT secret exists -- skipping
Migrating database

[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 users add unique users_email_unique(e mail))

php: php --version
PHP 7.0.15 (cli) (built: Jan 19 2017 21:35:05) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.15, Copyright (c) 1999-2017, by Zend Technologies
[edit: this is on an Ubuntu Linode VPS machine]

[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Any help would be greatly appreciated. A quick web search said this is likely caused by the database type being InnoDB and not MyISAM? I couldn't find anywhere in the configs to change the db type.

Originally created by @cllorca on GitHub (Mar 7, 2017). Original GitHub issue: https://github.com/koel/koel/issues/552 I couldn't find this issue in the troubleshooting section of the documentation, nor could I find it here in the git issue tracker. I followed the steps for installation according to installation guide: https://koel.phanan.net/docs/#/?id=installation composer.phar executed fine. Then I added my db credentials to .env. Finally when I ran php artisan koel:init' I got the following error which halts the installation as the database seeding fails: php artisan koel:init Attempting to install or upgrade Koel. Remember, you can always install/upgrade manually following the guide here: 📙 https://koel.phanan.net/docs App key exists -- skipping JWT secret exists -- skipping Migrating database [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 `users` add unique `users_email_unique`(`e mail`)) php: php --version PHP 7.0.15 (cli) (built: Jan 19 2017 21:35:05) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.15, Copyright (c) 1999-2017, by Zend Technologies [edit: this is on an Ubuntu Linode VPS machine] [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Any help would be greatly appreciated. A quick web search said this is likely caused by the database type being InnoDB and not MyISAM? I couldn't find anywhere in the configs to change the db type.
kerem closed this issue 2026-02-26 02:33:04 +03:00
Author
Owner

@phanan commented on GitHub (Mar 8, 2017):

Have you tried the fix here: #542?

<!-- gh-comment-id:284940283 --> @phanan commented on GitHub (Mar 8, 2017): Have you tried the fix here: #542?
Author
Owner

@Nev3rGiveUp commented on GitHub (Mar 11, 2017):

I tried the suggestion from #542 but I still have the problem because I don't know in what file what to change actually... I'm not an expert, I managed to change it into the file *_create_users_table.php and *_create_artists_table.php but I still get this error while running "php artisan koel:init":

http://image.prntscr.com/image/b5021224bb6a47fcaa6918e987d1a704.png

<!-- gh-comment-id:285898416 --> @Nev3rGiveUp commented on GitHub (Mar 11, 2017): I tried the suggestion from #542 but I still have the problem because I don't know in what file what to change actually... I'm not an expert, I managed to change it into the file *_create_users_table.php and *_create_artists_table.php but I still get this error while running "php artisan koel:init": http://image.prntscr.com/image/b5021224bb6a47fcaa6918e987d1a704.png
Author
Owner

@Andy-H-Nguyen commented on GitHub (Mar 23, 2017):

Hmm I have this issue when I switch to master. But v3.5.5 works just fine.

<!-- gh-comment-id:288817647 --> @Andy-H-Nguyen commented on GitHub (Mar 23, 2017): Hmm I have this issue when I switch to `master`. But `v3.5.5` works just fine.
Author
Owner

@Andy-H-Nguyen commented on GitHub (Mar 23, 2017):

A workaround is to php artisan koel:init
v3.5.5 first, then switch to master and then use php artisan koel:init

<!-- gh-comment-id:288820152 --> @Andy-H-Nguyen commented on GitHub (Mar 23, 2017): A workaround is to `php artisan koel:init` `v3.5.5` first, then switch to `master` and then use `php artisan koel:init`
Author
Owner

@cllorca commented on GitHub (Mar 24, 2017):

Thanks for the tips. I've been offline a few weeks but I'll try and get a fresh vps online and try deploying Koel again. Will report back any success or failure. Thanks

On Mar 23, 2017, at 2:36 PM, Andy Nguyen notifications@github.com wrote:

A workaround is to php artisan koel:init
v3.5.5 first, then switch to master and then use php artisan koel:init


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<!-- gh-comment-id:289022629 --> @cllorca commented on GitHub (Mar 24, 2017): Thanks for the tips. I've been offline a few weeks but I'll try and get a fresh vps online and try deploying Koel again. Will report back any success or failure. Thanks > On Mar 23, 2017, at 2:36 PM, Andy Nguyen <notifications@github.com> wrote: > > A workaround is to php artisan koel:init > v3.5.5 first, then switch to master and then use php artisan koel:init > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub, or mute the thread. >
Author
Owner

@Andy-H-Nguyen commented on GitHub (Mar 24, 2017):

You should be using v3.5.5 anyways as it is stable and easier to set-up. master atm doesn't work without a couple of additional steps.

<!-- gh-comment-id:289040810 --> @Andy-H-Nguyen commented on GitHub (Mar 24, 2017): You should be using `v3.5.5` anyways as it is stable and easier to set-up. `master` atm doesn't work without a couple of additional steps.
Author
Owner

@cllorca commented on GitHub (Mar 24, 2017):

I will init 3.5.5 then when I get there. Thanks!

On Mar 24, 2017, at 10:39 AM, Andy Nguyen notifications@github.com wrote:

You should be using v3.5.5 anyways as it is stable and easier to set-up. master atm doesn't work without a couple of additional steps.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<!-- gh-comment-id:289042354 --> @cllorca commented on GitHub (Mar 24, 2017): I will init 3.5.5 then when I get there. Thanks! > On Mar 24, 2017, at 10:39 AM, Andy Nguyen <notifications@github.com> wrote: > > You should be using v3.5.5 anyways as it is stable and easier to set-up. master atm doesn't work without a couple of additional steps. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub, or mute the thread. >
Author
Owner

@ghost commented on GitHub (Mar 24, 2017):

@cllorca see my comments on #542; the workaround for this problem is a relatively simple change.

@phanan - I'm not great with the world of PHP; is there a way to check the Laravel version during the initalization in /path/to/koel/app/Providers/App/AppServiceProvider.php? If there is, this could be fixed by simply updating the boot function to set the default string length when the Laravel version is newer than the version supported.

EDIT: I meant Illuminate, not Laravel.

<!-- gh-comment-id:289045682 --> @ghost commented on GitHub (Mar 24, 2017): @cllorca see my comments on #542; the workaround for this problem is a relatively simple change. @phanan - I'm not great with the world of PHP; is there a way to check the Laravel version during the initalization in `/path/to/koel/app/Providers/App/AppServiceProvider.php`? If there is, this could be fixed by simply updating the `boot` function to set the default string length when the Laravel version is newer than the version supported. EDIT: I meant Illuminate, not Laravel.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#393
No description provided.