I've been reading several variations of this question and related articles, and although I did solve my problem in the end (ended up doing s/utf8mb4/utf8/g
on my sql script), I am still at a loss why this works on MySQL as it is, but had to the search replace in MariaDB.
The setup:
- Machine 1: Mysql 5.7.19
- Machine 2: MariaDb 10.1.25
On both machines I created the database like:
CREATE DATABASE `test` COLLATE 'utf8mb4_general_ci'
The input script is a 16MB SQL file, with around 300 tables, all of them declared as ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED
When I try to import this file on MariaDb, I get:
ERROR 1071 (42000) at line 602: Specified key was too long; max key length is 767 bytes
But I import the same file witout changes on MySQL, and all tables are created just fine.
To be able to do the same on the MariaDB machine, I need to do the aforementioned s/utf8mb4/utf8/g
before running the script.
The gist of the question is: Is there a way I can setup MariaDB so I can import the file in the same format than as in MySQL?
Regarding the duplicate rasied by @Cbroe, it fails in a couple of ways:
1 - It explains the difference in index size between MyIsam and InnoDB (and I'm using InnoDB in both cases, and while it works in MySQL it fails in MariaDB).
2 - It doesn't explain how to make MariaDB behave as MySQL, if it is possible. Since it is possible to have this script work with this engine and this encoding work on MySQL, is it possible to do the same in MariaDB? If not, why not?
Furthermore, we already have a working answer that is distinct from the ones in the alleged duplicate.