Error Message Character Set The resulting server uses  latin1  and  latin1_swedish_ci  as the default for databases and tables and for client connections. It is unnecessary to use  --character-set-server  and  --collation- server  to specify those defaults at server startup. It is also unnecessary for applications to configure their connection using  SET NAMES  or equivalent after they connect to the server. Regardless of how you configure the MySQL character set for application use, you must also consider the environment within which those applications execute. For example, if you intend to send statements using UTF-8 text taken from a file that you create in an editor, you should edit the file with the locale of your environment set to UTF-8 so that the file encoding is correct and so that the operating system handles it correctly. If you use the  mysql  client from within a terminal window, the window must be configured to use UTF-8 or characters may not display properly. For a script that executes in a Web environment, the script must handle character encoding properly for its interaction with the MySQL server, and it must generate pages that correctly indicate the encoding so that browsers know how to display the content of the pages. For example, you can include this  <meta>  tag within your  <head>  element: This section describes how the MySQL server uses character sets for constructing error messages. For information about the language of error messages (rather than the character set), see Section 10.12, “Setting the Error Message Language” . For general information about configuring error logging, see Section 5.4.2, “The Error Log” . The server constructs error messages as follows: An error message, once constructed, can be written by the server to the error log or sent to clients: Character Set for Error Message Disposition Character Set for Error Message Construction 10.6 Error Message Character Set •If the server writes the error message to the error log, it writes it in UTF-8, as constructed, without conversion to another character set. •Character (nonbinary) string values are converted from their character set to UTF-8. •Identifiers such as table or column names use UTF-8 internally so they are copied as is. •Parameters in the message template are replaced with values that apply to a specific error occurrence: •The message template uses UTF-8 ( utf8mb3 ). •Character Set for Error Message Construction •Character Set for Error Message Disposition cmake . -DDEFAULT_CHARSET=latin1 \ -DDEFAULT_COLLATION=latin1_swedish_ci <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Duplicate entry ’A\xCF\x9F’ for key 1 1951 •Binary string values are copied as is for bytes in the range  0x20  to  0x7E , and using  \x  hexadecimal encoding for bytes outside that range. For example, if a duplicate-key error occurs for an attempt to insert  0x41CF9F  into a  VARBINARY  unique column, the resulting error message uses UTF-8 with some bytes hexadecimal encoded: