• utf8mb4_0900_ai_ci  is implemented only as of MySQL 8.0, so the 5.7 server does not recognize it. 

•Because the 5.7 server does not recognize utf8mb4_0900_ai_ci , it cannot satisfy the client character set request, and falls back to its default character set and collation ( latin1  and latin1_swedish_ci ). 

In this case, the client can still use utf8mb4  by issuing a SET NAMES ’utf8mb4’  statement after connecting. The resulting collation is the 5.7 default utf8mb4  collation; that is, utf8mb4_general_ci . If the client additionally wants a collation of utf8mb4_0900_ai_ci , it cannot achieve that because the server does not recognize that collation. The client must either be willing to use a different utf8mb4 collation, or connect to a server from MySQL 8.0 or higher. 

## Runtime Error Handling 

Within an established connection, the client can request a change of connection character set and collation with SET NAMES  or SET CHARACTER SET . 

Some character sets cannot be used as the client character set; see Impermissible Client Character Sets. If you specify a character set that is valid but not permitted as a client character set, the server returns an error: 

mysql> SET NAMES ’ucs2’; ERROR 1231 (42000): Variable ’character_set_client’ can’t be set to the value of ’ucs2’ 

If the server does not recognize the character set (or the collation), it produces an error: 

mysql> SET NAMES ’bogus’; ERROR 1115 (42000): Unknown character set: ’bogus’ 

mysql> SET NAMES ’utf8mb4’ COLLATE ’bogus’; ERROR 1273 (HY000): Unknown collation: ’bogus’ 

## Tip 

A client that wants to verify whether its requested character set was honored by the server can execute the following statement after connecting and checking that the result is the expected character set: 

SELECT @@character_set_client; 

## 10.5 Configuring Application Character Set and Collation 

For applications that store data using the default MySQL character set and collation ( utf8mb4 , utf8mb4_0900_ai_ci ), no special configuration should be needed. If applications require data storage using a different character set or collation, you can configure character set information several ways: 

•Specify character settings per database. For example, applications that use one database might use the default of utf8mb4 , whereas applications that use another database might use sjis . 

•Specify character settings at server startup. This causes the server to use the given settings for all applications that do not make other arrangements. 

•Specify character settings at configuration time, if you build MySQL from source. This causes the server to use the given settings as the defaults for all applications, without having to specify them at server startup. 

When different applications require different character settings, the per-database technique provides a good deal of flexibility. If most or all applications use the same character set, specifying character settings at server startup or configuration time may be most convenient. 

