MySQL VARCHAR(255) UTF8 is too long for key, but max length is 1000 bytes

If you’re using utf8mb4, and you have unique indexes on varchar columns that are greater than 191 characters in length, you’ll need to turn on innodb_large_prefix to allow for larger columns in indexes, because utf8mb4 requires more storage space than utf8 or latin1. Add the following to your my.cnf file. [mysqld] innodb_file_format=barracuda innodb_file_per_table=1 innodb_large_prefix=1 init_connect=”SET … Read more

MySQL utf8mb4, Errors when saving Emojis

character_set_client, _connection, and _results must all be utf8mb4 for that shortcake to be eatable. Something, somewhere, is setting a subset of those individually. Rummage through my.cnf and phpmyadmin’s settings — something is not setting all three. If SET NAMES utf8mb4 is executed, all three set correctly. The sun shone because it is only 3-bytes – … Read more

“Incorrect string value” when trying to insert UTF-8 into MySQL via JDBC?

MySQL’s utf8 permits only the Unicode characters that can be represented with 3 bytes in UTF-8. Here you have a character that needs 4 bytes: \xF0\x90\x8D\x83 (U+10343 GOTHIC LETTER SAUIL). If you have MySQL 5.5 or later you can change the column encoding from utf8 to utf8mb4. This encoding allows storage of characters that occupy … Read more

What is the difference between utf8mb4 and utf8 charsets in MySQL?

UTF-8 is a variable-length encoding. In the case of UTF-8, this means that storing one code point requires one to four bytes. However, MySQL’s encoding called “utf8” (alias of “utf8mb3”) only stores a maximum of three bytes per code point. So the character set “utf8″/”utf8mb3” cannot store all Unicode code points: it only supports the … Read more

tech