NAME
mysqltable - Postfix MySQL client configuration
SYNOPSIS
ppoossttmmaapp -qq ""string"" mmyyssqqll:://eettcc//ppoossttffiixx//ffiilleennaammee
ppoossttmmaapp -qq - mmyyssqqll:://eettcc//ppoossttffiixx//filename
DESCRIPTION
The Postfix mail system uses optional tables for address rewriting or mail routing. These tables are usually in ddbbmm or ddbb format. Alternatively, lookup tables can be specified as MySQL databases. In order to use MySQL lookups, define a MySQL source as a lookup table in main.cf, for example:aliasmaps = mysql:/etc/mysql-aliases.cf
The file /etc/postfix/mysql-aliases.cf has the same format as the Post-
fix main.cf file, and can specify the parameters described below. AALLTTEERRNNAATTIIVVEE CCOONNFFIIGGUURRAATTIIOONN For compatibility with other Postfix lookup tables, MySQL parameters can also be defined in main.cf. In order to do that, specify as MySQL source a name that doesn't begin with a slash or a dot. The MySQL parameters will then be accessible as the name you've given the source in its definition, an underscore, and the name of the parameter. For example, if the map is specified as "mysql:mysqlname", the parameter "hosts" below would be defined in main.cf as "mysqlnamehosts". Note: with this form, the passwords for the MySQL sources are writtenin main.cf, which is normally world-readable. Support for this form
will be removed in a future Postfix version. LLIISSTT MMEEMMBBEERRSSHHIIPPWhen using SQL to store lists such as $mynetworks, $mydestination,
$relaydomains, $localrecipientmaps, etc., it is important to under-
stand that the table must store each list member as a separate key. The table lookup verifies the *existence* of the key. See "Postfix lists versus tables" in the DATABASEREADME document for a discussion.Do NOT create tables that return the full list of domains in $mydesti-
nation or $relaydomains etc., or IP addresses in $mynetworks.
DO create tables with each matching item as a key and with an arbitrary value. With SQL databases it is not uncommon to return the key itself or a constant value. MMYYSSQQLL PPAARRAAMMEETTEERRSS hhoossttss The hosts that Postfix will try to connect to and query from. Specify unix: for UNIX domain sockets, inet: for TCP connections (default). Example: hosts = host1.some.domain host2.some.domain hosts = unix:/file/name The hosts are tried in random order, with all connections overUNIX domain sockets being tried before those over TCP. The con-
nections are automatically closed after being idle for about 1minute, and are re-opened as necessary. Postfix versions 2.0 and
earlier do not randomize the host order.NOTE: if you specify localhost as a hostname (even if you prefix
it with inet:), MySQL will connect to the default UNIX domain socket. In order to instruct MySQL to connect to localhost over TCP you have to specify hosts = 127.0.0.1 uusseerr,, ppaasssswwoorrddThe user name and password to log into the mysql server. Exam-
ple: user = someone password = somepassword ddbbnnaammee The database name on the servers. Example: dbname = customerdatabase The following parameters are used to fill in a SELECT query template of the form: select [sseelleeccttffiieelldd] from [ttaabbllee] where[wwhheerreeffiieelldd] = '$lookup' [aaddddiittiioonnaallccoonnddiittiioonnss]
$lookup contains the search string, and is escaped so if it contains
single quotes or other odd characters, it will not cause a parse error, or worse, a security problem. sseelleeccttffiieelldd The SQL "select" parameter. Example: selectfield = forwaddr ttaabbllee The SQL "select .. from" table name. Example: table = mxaliases wwhheerreeffiieelldd The SQL "select .. where" parameter. Example: wherefield = alias aaddddiittiioonnaallccoonnddiittiioonnss Additional conditions to the SQL query. Example: additionalconditions = and status = 'paid'SEE ALSO
postmap(1), Postfix lookup table maintenance postconf(5), configuration parameters ldaptable(5), LDAP lookup tables pgsqltable(5), PostgreSQL lookup tables README FILES Use "ppoossttccoonnff rreeaaddmmeeddiirreeccttoorryy" or "ppoossttccoonnff hhttmmllddiirreeccttoorryy" to locate this information. DATABASEREADME, Postfix lookup table overview MYSQLREADME, Postfix MYSQL client guide LLIICCEENNSSEE The Secure Mailer license must be distributed with this software. HISTORY MySQL support was introduced with Postfix version 1.0. AUTHOR(S) Original implementation by: Scott Cotton, Joshua Marcus IC Group, Inc. Further enhancements by: Liviu Daia Institute of Mathematics of the Romanian AcademyP.O. BOX 1-764
RO-014700 Bucharest, ROMANIA
MYSQLTABLE(5)