Description\n-----------\n\nWhat are Character Sets and Collations?\n\nA character set is a set of characters, while a collation comprises the rules for comparing and sorting a particular character set.\n\nFor example, a subset of a character set could consist of the letters A, B and C. A default collation could define these as appearing in an ascending order of A, B, C.\n\nIf we consider different case characters, more complexity is added. A binary collation would evaluate the characters A and a differently, ordering them in a particular way. A case-insensitive collation would evaluate A and a equivalently, while the German phone book collation evaluates the characters ue and ü equivalently.\n\nA character set can have many collations associated with it, while each collation is only associated with one character set. In MariaDB, the character set name is always part of the collation name. For example, the latin1_german1_ci collation applies only to the latin1 character set. Each character set also has one default collation. The latin1 default collation is latin1_swedish_ci.\n\nAs an example, by default, the character y comes between x and z, while in Lithuanian, it's sorted between i and k. Similarly, the German phone book order is different to the German dictionary order, so while they share the same character set, the collation is different.\n\nViewing Character Sets and Collations\n\nThe default character set is utf8mb4 and the default collation is utf8mb4_uca1400_ai_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nThe default character set is latin1 and the default collation is latin1_swedish_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nYou can view a full list of character sets and collations supported by MariaDB at Supported Character Sets and Collations, or see what's supported on your server with the SHOW CHARACTER SET and SHOW COLLATION commands.\n\nBy default, A comes before Z, so the following evaluates to true:\n\n``sql\nSELECT "A" < "Z";\n+-----------+\n| "A" < "Z" |\n+-----------+\n|         1 |\n+-----------+\n`\n\nBy default, comparisons are case-insensitive:\n\n`sql\nSELECT "A" < "a", "A" = "a";\n+-----------+-----------+\n| "A" < "a" | "A" = "a" |\n+-----------+-----------+\n|         0 |         1 |\n+-----------+-----------+\n`\n\nChanging Character Sets and Collations\n\nCharacter sets and collations can be set from the server level right down to the column level, as well as for client-server communication.\n\nFor example, ue and ü are by default evaluated differently.\n\n`sql\nSELECT 'Mueller' = 'Müller';\n+----------------------+\n| 'Müller' = 'Mueller' |\n+----------------------+\n|                    0 |\n+----------------------+\n`\n\nBy using the collation_connection system variable to change the connection character set to latin1_german2_ci, or German phone book, the same two characters will evaluate as equivalent.\n\n`sql\nSET collation_connection = latin1_german2_ci;\n\nSELECT 'Mueller' = 'Müller';\n+-----------------------+\n| 'Mueller' = 'Müller'  |\n+-----------------------+\n|                     1 |\n+-----------------------+\n``\n\nSee Setting Character Sets and Collations for more.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/character-set-and-collation-overview