Re: [exim] multiple mysql databases

Top Page
Delete this message
Reply to this message
Author: Peter Bowyer
Date:  
To: exim-users
Subject: Re: [exim] multiple mysql databases
Olivier <oricard@???> wrote:
> Hello,
>
> I setup exim4 with mysql support. It works fine with 1 database. But
> it doens't work with 2 databases.
>
> Here my conf in main/01_exim4-config_listmacrosdefs
>
> hide mysql_servers =
>

localhost/databasename1/databaseuser1/databasepwd1:localhost/databasename2/d
> atabaseuser2/databasepwd2
>
> I setup 2 routers for each database. Each database is linked to a
> domain.
>
> virtual_domain1_mysql_aliases:
>   driver = accept
>   transport = domain1_mysql_delivery
>   condition = ${lookup mysql{ SELECT email_recipient FROM emails WHERE
> email_recipient='${quote_mysql:${local_part}@${domain}}'
> <mailto:${local_part}@${domain}}'>  }}
>    user = mail
>   group = mail
>   domains = domain1

>
> virtual_domain2_mysql_aliases:
>   driver = accept
>   transport = domain2_mysql_delivery
>   condition = ${lookup mysql{ SELECT blog_recipient FROM emails WHERE
> email_recipient='${quote_mysql:${local_part}@${domain}}'
> <mailto:${local_part}@${domain}}'>  }}
>    user = mail
>   group = mail
>   domains = domain2

>
> The router 1 works fine with the first database but with the second
> database the router doens't work. Exim4 doesn't seem to lookup the
> 2nd database.


Exim will use the first listed connection which doesn't error on the query.
Since both your tables are named 'emails', then neither query will ever
error (note 'error', contrast with 'return no rows'). So exim will always
use the first listed connection.

Test this by renaming the table in the second database and adjusting the
query accordingly. Or try '... FROM database2.emails' in the second query.

Peter