Reputation: 9787
I use Mamp 3.4. I have a small database with 3 tables. When I upload the database file to the server I have that error: #1115 - Unknown character set: 'utf8mb4'
I have gone back to MAMP and check: Operations > Collation > utf8_unicode_ci I have that in each table and in the general database
To export I select the database > Export > Custom > Save Output to a file. In the rest of things I leave the default.
Where is the problem? what is that mb4? is the utf8_unicode_ci the right one? How to export from MAMP and import in my server?
Upvotes: 1
Views: 2056
Reputation: 34232
Let's get one thing straight: character set is not the same as collation. The two concepts are closely realted only.
Character sets tell the programs processing text how to interpret the byte stream that makes up the text and what character to display on the screen.
Collations tell the programs processing text how to order characters for comparison and sorting purposes. So, if you do an order by on a text field in an RDBMS, then the RDBMS can figure out using the collation the order of the records.
utf8mb4 is a character set MySql uses. MySql's implementation of utf8 can represent a character on up to 3 bytes, while utf8mb4 can represent characters on up to 4 bytes. The utf8 standard uses the up to 4 bytes definition (utf8, wikipedia), so strictly speaking, utf8mb4 is the true utf8 implementation in mysql.
However, utf8mb4 has only been added relatively recently (v5.5.3), so its existence is still not that widely known in the mysql community (MySql utf8mb4).
If you try to import data using this character set to a database that does not support it, then you get the error message in your question.
Collation should match the encoding, so if you have utf8mb4 character set, then use an utf8mb4 collation as well. You need to convert your data to a character set that is supported by your target system and you need to align the collation with your encoding.
Upvotes: 2