Mysql Globalization Abstract
Total Page:16
File Type:pdf, Size:1020Kb
MySQL Globalization Abstract This is the MySQL Globalization extract from the MySQL 8.0 Reference Manual. For legal information, see the Legal Notices. For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQL users. Document generated on: 2021-09-27 (revision: 70895) Table of Contents Preface and Legal Notices .................................................................................................................. v 1 Character Sets, Collations, Unicode ................................................................................................. 1 1.1 Character Sets and Collations in General .............................................................................. 2 1.2 Character Sets and Collations in MySQL ............................................................................... 3 1.2.1 Character Set Repertoire ........................................................................................... 5 1.2.2 UTF-8 for Metadata ................................................................................................... 7 1.3 Specifying Character Sets and Collations .............................................................................. 8 1.3.1 Collation Naming Conventions .................................................................................... 9 1.3.2 Server Character Set and Collation .......................................................................... 10 1.3.3 Database Character Set and Collation ...................................................................... 10 1.3.4 Table Character Set and Collation ............................................................................ 12 1.3.5 Column Character Set and Collation ......................................................................... 12 1.3.6 Character String Literal Character Set and Collation .................................................. 14 1.3.7 The National Character Set ...................................................................................... 15 1.3.8 Character Set Introducers ........................................................................................ 16 1.3.9 Examples of Character Set and Collation Assignment ................................................ 18 1.3.10 Compatibility with Other DBMSs ............................................................................. 19 1.4 Connection Character Sets and Collations ........................................................................... 19 1.5 Configuring Application Character Set and Collation ............................................................. 25 1.6 Error Message Character Set .............................................................................................. 27 1.7 Column Character Set Conversion ...................................................................................... 28 1.8 Collation Issues .................................................................................................................. 29 1.8.1 Using COLLATE in SQL Statements ......................................................................... 29 1.8.2 COLLATE Clause Precedence ................................................................................. 30 1.8.3 Character Set and Collation Compatibility ................................................................. 30 1.8.4 Collation Coercibility in Expressions .......................................................................... 30 1.8.5 The binary Collation Compared to _bin Collations ...................................................... 32 1.8.6 Examples of the Effect of Collation ........................................................................... 34 1.8.7 Using Collation in INFORMATION_SCHEMA Searches ............................................. 36 1.9 Unicode Support ................................................................................................................. 38 1.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding) ................................... 39 1.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding) ................................... 40 1.9.3 The utf8 Character Set (Alias for utf8mb3) ................................................................ 41 1.9.4 The ucs2 Character Set (UCS-2 Unicode Encoding) .................................................. 41 1.9.5 The utf16 Character Set (UTF-16 Unicode Encoding) ................................................ 41 1.9.6 The utf16le Character Set (UTF-16LE Unicode Encoding) .......................................... 42 1.9.7 The utf32 Character Set (UTF-32 Unicode Encoding) ................................................ 42 1.9.8 Converting Between 3-Byte and 4-Byte Unicode Character Sets ................................. 42 1.10 Supported Character Sets and Collations ........................................................................... 45 1.10.1 Unicode Character Sets ......................................................................................... 46 1.10.2 West European Character Sets .............................................................................. 53 1.10.3 Central European Character Sets ........................................................................... 54 1.10.4 South European and Middle East Character Sets .................................................... 55 1.10.5 Baltic Character Sets ............................................................................................. 56 1.10.6 Cyrillic Character Sets ............................................................................................ 56 1.10.7 Asian Character Sets ............................................................................................. 57 1.10.8 The Binary Character Set ....................................................................................... 61 1.11 Restrictions on Character Sets .......................................................................................... 63 1.12 Setting the Error Message Language ................................................................................. 63 1.13 Adding a Character Set .................................................................................................... 64 1.13.1 Character Definition Arrays ..................................................................................... 66 iii MySQL Globalization 1.13.2 String Collating Support for Complex Character Sets ............................................... 66 1.13.3 Multi-Byte Character Support for Complex Character Sets ........................................ 67 1.14 Adding a Collation to a Character Set ................................................................................ 67 1.14.1 Collation Implementation Types .............................................................................. 68 1.14.2 Choosing a Collation ID ......................................................................................... 71 1.14.3 Adding a Simple Collation to an 8-Bit Character Set ................................................ 72 1.14.4 Adding a UCA Collation to a Unicode Character Set ................................................ 73 1.15 Character Set Configuration .............................................................................................. 80 1.16 MySQL Server Locale Support .......................................................................................... 80 2 MySQL Server Time Zone Support ................................................................................................ 85 iv Preface and Legal Notices This is the MySQL Globalization extract from the MySQL 8.0 Reference Manual. Licensing information—MySQL 8.0. This product may include third-party software, used under license. If you are using a Commercial release of MySQL 8.0, see the MySQL 8.0 Commercial Release License Information User Manual for licensing information, including licensing information relating to third- party software that may be included in this Commercial release. If you are using a Community release of MySQL 8.0, see the MySQL 8.0 Community Release License Information User Manual for licensing information, including licensing information relating to third-party software that may be included in this Community release. Legal Notices Copyright © 1997, 2021, Oracle and/or its affiliates. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs)