When using ddev import-db
to import a production db dump for TYPO3 9 into a ddev project I had a mysql error:
"Index column size too large. The maximum column size is 767 bytes."
This seems to be the result of importing a regular utf8 charset db into ddev, which is set up for utf8mb4, using 4 bytes for character, and overrunning the index column size.
What's the solution? (Besides changing the column definition, changing my prod site and db, etc.)
This issue was originally discussed and solved in https://github.com/drud/ddev/issues/654
There is now a way to override the default mysql setting in ddev.
The example MariaDB/mysql override docs show exactly this example.
In your project's .ddev/mysql directory, add a file called utf8ci.cnf (or whatever you want it to be called, as long as it ends in .cnf) with these contents:
[mysqld]
collation-server = utf8_general_ci
character-set-server = utf8
innodb_large_prefix=false