Description of "SET NAMES" command says "the character set to be used in subsequent database transactions". It must be "connections" instead.