Re: [exim] Exim and MySQL with UTF-8 encoding

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Yves Goergen
CC: Exim-users list
Subject: Re: [exim] Exim and MySQL with UTF-8 encoding
On 2017-11-08 at 22:15 +0100, Yves Goergen wrote:
> How can I tell Exim to talk to the MySQL server with UTF-8 encoding?


If "[exim]" is not already in my.cnf then perhaps:

# printf '[exim]\ncharacter_set_client=utf8\n' >> /etc/my.cnf

Exim specifies an option group to the MySQL client library. The default
value given is "exim", so in `/etc/my.cnf` you can have a section
starting `[exim]` and put whatever options you want in there.

(MySQL searches a range of places, my last blog-post where I touched
this, I noted that Ubuntu required /etc/mysql/my.cnf so ... figure out
which ones actually work on your distribution; I'm going to write
/etc/my.cnf here)

If that's not specific enough and you want other clients, then the Exim
configuration option `mysql_servers` or the server-spec at the start of
the query has an expanded syntax, as described in "Special MySQL
features" in The Exim Specification:

host:port(socket)[group]

The `[group]` part there is the name of the group parsed from
`/etc/my.cnf`. So `mysql_servers = maildb.example.com[exim-utf8]`
should work just fine.

My MySQL is incredibly rusty, but I think something like:

/etc/my.cnf :

[exim]
host=maildb.example.com
ssl
ssl-capath=/etc/ssl/certs/
character_set_client=utf8

-Phil