D
D
Dauren S2017-02-04 17:36:51
MySQL
Dauren S, 2017-02-04 17:36:51

Laravel too long max key length is 767 bytes?

Mysql error occurs during migration. Too long: max key length is 767 bytes

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
Dauren S, 2017-02-04
@dauren101

In general, we go to the laravel settings. Db.php and change encoding from utf8m64 to utf8

M
Melkij, 2017-02-04
@melkij

The size of one index record is limited.
For the version of mysql you are using, the memory page size is a maximum index record length of 767 bytes. Those. 255 characters utf8, 191 characters utf8mb4 and corresponding arithmetic for composite keys. Reduce the field or use an index prefix so that the length of the index entry fits into 767 bytes.

A
Anton, 2017-02-04
@Yadalay

I had the same error. Therefore, in the fields of the varchar type, I used a maximum of 150 characters, not 255. This is how the hoster had it. On the local I'm fine. If you do not want to reduce the number of characters, then you probably need to delve into the mysql settings.

V
varz62, 2017-02-04
@varz62

here is my answer on another service
http://ru.stackoverflow.com/questions/620958/%d0%9...
but in general the problem has been discussed more than once

A
Alexandr Sitchenko, 2018-09-07
@Nirbis

Try just changing the encoding from utf8mb4 to utf8.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question