-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
mysql key length errors with utf8mb4 #17337
Comments
I was also seeing this issue yesterday. L5.4, PHP 7.0.13, MySQL 5.6.34 |
It was discussed many times. for example here #11451 Shortly what is going wrong: So you can reduce length of column to 191 |
Mysql 5.7.7 introduced changes to the default innodb parameters.
Source: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-7.html |
Yeah i understand whats going on, my issue is that out of the box things don't work, if mysql5.7 is a requirement we should document that, or at least have something in the docs to explain whats going on when this happens |
Been playing with this one tonight. Did the switch from mysql -> mariadb. Going back to get mysql 5.7 to make this go away would cost me a lot of time with having to dump and replay a couple of large databases. When mariadb 10.2 is stable and released, this will go away as the defaults mirror mysql 5.7.7 Using mariadb 10.1.21 which are both defaults in 10.2 unfortunately the directive ROW_FORMAT=DYNAMIC only exists from 10.2.2 but found adding the directive to the sql string in MySqlGrammar after collation for every table creation does the trick and creates the larger index keeping everything happy in 10.1.x Believe this will also work for MySQL 5.6 |
An hack would be |
This should be still open. Lots of migrations just die on this issue for MariaDB users. BTW, for anyone out there, the easy fix is here: Why is this (191) not default for Laravel? |
I agree this should be open and probably the default length changed. I assume there is no special reason that it is 255 now, other than that used to be the max length back in MySQL < 5.0.3?
There are lots of tickets for this same thing #17530 #17508 #17337 #17714 #20012 because On the upside, it is well documented 👍, but better |
I propose an alternative to |
Any up to date ways to solve this? With latest mariadb, and laravel. |
Problem still seems to persist as of today, at least for me. |
Description:
Setting the default collation to utf8mb4 (see laravel/laravel@9d01389) means that out of the box migrations failed with a mysql key length error:
Previously raised in #15725
Steps To Reproduce:
composer create-project laravel/laravel okr dev-develop
config the db connection in
.env
and add a database withutf8mb4
andutf8mb4_unicode_ci
php artisan migrate
The text was updated successfully, but these errors were encountered: