Wednesday, 4 December 2013

Set MySql output charset

The character set of the results returned by MySql is controlled by character_set_results variable. When a client connects to a MySql server, this variable is set to the character set of the environment of the client. So, if you connect from a ISO-8859-1 (latin 1) console, the variable is set to latin 1 encoding. The current value can be checked by the following query.

show variables;

To set the variable, the client can be initialized from a console which has its encoding set appropriately or one can run the following query.

set character_set_results = <character_set>;

No comments: